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