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