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 -> Programming

 $db->query [PHP, SQLite Question]

Print topic Send  topic

Author Message
jg1130

Posts: 6
Posted: 01/10/2005, 5:33 PM

I have inserted the following statement into the After Insert event:

$db->query("INSERT INTO contacts (ID) VALUES (NULL)");

I am using a SQLite db, the insert statement works and will autoincrement the ID field when used from the command line.

However I can not get it to work in CC. I guess I don't use CC enough to stay proficient with it.

Can anyone offer a solution?

Thanks,

Juan
View profile  Send private message
Juan
Posted: 01/10/2005, 6:54 PM

I got the sql query to autoincrement the ID number in the After Insert event with:

$db->query("INSERT INTO contacts (ID) VALUES((SELECT max(ID) FROM contacts)+1)");

Now I need to link the inserted record with the newly created ID number. I'm not sure how this is done. Maybe with a Select statement?

Thanks,

Juan
Juan
Posted: 01/10/2005, 10:32 PM

I have tried the following:
$db->query("INSERT INTO contacts (ID,CompanyName) VALUES((SELECT max(ID) FROM contacts)+1,$fldCompanyName");
I do not understand the corrent syntax for a form field value in an SQL statement. In the example you can see that I've used $fldCompanyName

Any help with this would be appreciated.

Thanks,

Juan
Nicole

Posts: 586
Posted: 01/19/2005, 4:39 AM

Juan,
You can try
  
$db->query("INSERT INTO contacts (ID,CompanyName) VALUES((SELECT max(ID) FROM contacts)+1, ". ToSQL($fldCompanyName, "Text"). ")");  

_________________
Regards,
Nicole
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.