CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Using events to set column values?

Print topic Send  topic

Author Message
mchalkley
Posted: 04/23/2003, 6:00 PM

Are there any examples anywhere that show how to update db columns via events? For example, I want to load a "Created Timestamp" datetime field when an Insert is done, and load a "Modified Timestamp" datetime field when an Update is done. I think I know which events to use, but I can't find an example of the code (PHP) to make sure the SQL to load the fields is generated.
hamilton
Posted: 04/25/2003, 7:44 AM

Rather than attempting to perform this operation with code, why don't you set the initial value of the database field to Now() [MS Access] or to GetDate() [SQL Server]. That handles the initial date time stamp when the record is inserted.

For updates, add a hidded field (I'll call the field Date_Added and call your page - 'messages') and link it to the date field.
On the Before update event for the record, place the following code.

Dim dteDateTime : dteDateTime = Now()
messages.date_added.value = dteDateTime


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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