This topic is locked

Last Edit

7/24/2007 7:22:48 AM
PHPRunner General questions
F
funkfish author

Hello,
I have a table that captures the date when a record is added.

What I want to do is have a second field that captures the date when a record is edited.
field 1 = now()

field 2 = now() when table is edited
Hoping someone can help out.

Many thanks!

Sergey Kornilov admin 7/24/2007

Use BeforeEdit event and the following code:

$values["field 2"]=now();
F
funkfish author 7/25/2007

Use BeforeEdit event and the following code:


$values["field 2"]=now();


Works great!
Thanks

M
morpheus 7/25/2007

Funkfish,
in my database I needed to keep an audit trail, so rather than just editing the records i make a copy using the copy function, in after add I set a field called "current" to "false", the new record has the "current" field set to "true", I also have a field that I set to keep a log of who edited the records which can be obtained by $_SESSION["UserID"], I also date/time stampa field that shows when a record was edited, This allows me to keep a complete history of all changes made to the database, when and by whom.
There are two tables, one for all records(including historic) and one for only current records (done by editing the SQL query to only pull out the records where "current" = true)
If you have any questions regarding this hen I'll be happy to help <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=19866&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
regards
Morpheus

B
Blooper 9/21/2007

Funkfish,

in my database I needed to keep an audit trail, so rather than just editing the records i make a copy using the copy function, in after add I set a field called "current" to "false", the new record has the "current" field set to "true", I also have a field that I set to keep a log of who edited the records which can be obtained by $_SESSION["UserID"], I also date/time stampa field that shows when a record was edited, This allows me to keep a complete history of all changes made to the database, when and by whom.
There are two tables, one for all records(including historic) and one for only current records (done by editing the SQL query to only pull out the records where "current" = true)
If you have any questions regarding this hen I'll be happy to help <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=21560&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
regards
Morpheus


Hello there. I'm really hoping U could help.
I'm just trying to add the currant date when someone has registered. I've tried about 19 difetent ways and I'm starting to think it is me who is to blame.
datebase : nvscouts

table : Models

field : date_join
Please could U help
Thanks.

Sergey Kornilov admin 9/21/2007

Use BeforeRegister event and the following code:

$userdata["date_join"] = now();