CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Updating Many-to-Many Relations via Two Listboxes

Print topic Send  topic

Author Message
incoronado

Posts: 12
Posted: 11/10/2014, 3:23 PM

I have abstracted the sample code out to reusable function. I have done this with other examples. It renders everything correct except it is not dynamically updating the where on the ListBox object.

Any ideas would be appreciated.

Here's the function that is designed to exclude what has already been selected.


function PopulateLists(& $FormObject, $MasterTable, $MasterID, $LookupTable, $LookupID, $ListObject) {

$DBConnection = null;
$LinkedProject = "";

//Select all projects of the currect user
if (intval(CCGetFromGet($MasterID,0)) > 0) {

//Create a new database connection object
$DBConnection = new clsDBjreapps();
$DBConnection->query("SELECT ".$LookupID." FROM ".$LookupTable." WHERE ".$LookupTable.".".$MasterID."=".$DBConnection->ToSQL(CCGetParam($MasterID,0),ccsInteger));
WriteDebug("SELECT ".$LookupID." FROM ".$LookupTable." WHERE ".$LookupTable.".".$MasterID."=".$DBConnection->ToSQL(CCGetParam($MasterID,0),ccsInteger), 2);
while($DBConnection->next_record()) {
if($LinkedProject != "") {
$LinkedProject .= ",";
}
$LinkedProject .= $DBConnection->f($LookupID);
}

//Destroy the database connection object
$DBConnection->close();
}

//Modify the Where clause of the AvailableListBox List Box
WriteDebug("$LookupID." NOT IN (".$LinkedProject."))",2);
if($LinkedProject != "") {
$FormObject->$ListObject->ds->Where = "$LookupID." NOT IN (".$LinkedProject."))";
//$employees_record->AvailableListBox->ds->Where = "project_id NOT IN (".$LinkedProject.")";
}
}
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.