novi
Posts: 8
|
| Posted: 03/10/2006, 3:04 AM |
|
I have a form which inserts new record into the database. ID field, not visible on the form, is autoincrement type, so value is known after sql is executed. I need to create custome code which will do something else based on the new ID value, but after pressing "add" button. Which Event is the best for that? I mean which event is triggered after SQL statement was executed?
Pawel
|
 |
 |
Garfieldus
Posts: 40
|
| Posted: 03/10/2006, 3:31 AM |
|
I do something like the following (in PHP) in the "After insert event" ...
$bookingID = CCDLookUp("max(id)", "datafile", "where",$DBconnection);
This will give you the record with the highest ID value. If another record could possibly be added while the above statement is executing you'll need to include the UserID in the where parameter.
HTH
|
 |
 |
novi
Posts: 8
|
| Posted: 03/10/2006, 3:44 AM |
|
I was not sure if use After Insert or After Execute Insert.
Thanks
|
 |
 |
guest
|
| Posted: 03/10/2006, 7:58 AM |
|
---------------------------------------
Sent from YesSoftware forum http://forums.codecharge.com/
|
|
|
 |
Last Hero
|
| Posted: 03/10/2006, 8:09 AM |
|
Try in After Execute Insert:
$Component->DataSource->query("Select last_insert_id() as l");
$Component->DataSource->next_record();
$id = $Component->DataSource->f("l");
CCS3/MySQL only
|
|
|
 |
novi
Posts: 8
|
| Posted: 03/10/2006, 11:10 PM |
|
Thanks again.
|
 |
 |
|