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 -> General/Other

 Events - which one?

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message
novi

Posts: 8
Posted: 03/10/2006, 3:44 AM

I was not sure if use After Insert or After Execute Insert.

Thanks :-)
View profile  Send private message
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.
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.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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