CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Many to Many Checkbox Example

Print topic Send  topic

Author Message
Koren

Posts: 83
Posted: 03/07/2006, 7:43 AM

I had been trying the above example through CCS 3 with no luck, I tried recreating the example in the older version of CCS 2.X and it worked fine! I opend the "working" example in CCS3.x and now I get a database (MySQL) error.
Database Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE property_id = 2' at line 1   
I echoed the SQL statement and got:
SQL: SELECT * FROM properties {SQL_Where} {SQL_OrderBy}  
ORDER BY:  
WHERE:property_id = 2  
How can I adjust the code to make it work right in the new version of CC?
I'm sure that you will need my version of the ProjectEmployeesModify function. I imagine it has to do with the curly brackets and I cant find where I can remove them from the query. Am I on the right track?

 function ProjectEmployeesModify($Actions){   
global $DBvbhma;  
  
  $EmpProjectConn = null;  
  $PropID = 0;  
  $AmenID = 0;  
  $AmenityList = array();  
  $GetLastInsKey = 0;  
  
  //Create a new database connection object  
  $EmpProjectConn = new clsDBvbhma();  
  
  //Retrieve the current project  
  $PropID = CCGetFromGet("property_id",0);  
  $AmenityList = CCGetFromPost("AmenityList",array());  
  
  if($Actions == "Insert"){  
     //Retrieve the last inserted key  
     //Use MS SQL method  
     //$GetLastInsKey = CCDLookup("@@IDENTITY","properties","",$DBvbhma);  
     //Use a method compatible with all databases (unsafe when multiple users insert records at the same time)  
     $GetLastInsKey = CCDLookup("max(property_id)", "properties", "", $DBvbhma);  
       
     //Insert New links  
	 reset($AmenityList);  
	 while(list($key,$AmenID) = each($AmenityList)){  
		$EmpProjectConn->query("INSERT INTO property_amenities(amenity_id, property_id) VALUES (".$EmpProjectConn->ToSQL($AmenID,ccsInteger).",".$EmpProjectConn->ToSQL($GetLastInsKey,ccsInteger).")");  
	 }  
  }  	   
  if($PropID >0){  
  	if( ($Actions == "Delete") Or ($Actions == "Update")){  
        //Delete project employees links  
     	$EmpProjectConn->query("DELETE FROM property_amenities WHERE property_id=".$EmpProjectConn->ToSQL($PropID,ccsInteger));  
    }   
  	if($Actions == "Update"){  
       //Insert assigned employees  
	   reset($AmenityList);  
       while(list($key,$AmenID) = each($AmenityList)){  
          $EmpProjectConn->query("INSERT INTO property_amenities(amenity_id, property_id) VALUES (".$EmpProjectConn->ToSQL($AmenID,ccsInteger).",".$EmpProjectConn->ToSQL($PropID,ccsInteger).")");  
       }  
    }  
  }  
  //Close and destroy the database connection object  
  $EmpProjectConn->close();  
}  
/code] 
                   
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.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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