In virtually every MySQL table I have the following fields:
Record_Last_Modified (timestamp)
Record_Modified_By (int)
Record_Added (timestamp)
Record_Added_By (int)
MySQL helps a little in that the FIRST timestamp in a table is automatically updated on record edits (even without a trigger), so the Record_Last_Modified field is always correct.
Here are the remaining issues and challenges:
I would like to NOT display these fields in the Edit and Add pages -- ONLY on LIST and VIEW pages if possible. [Alternatively, no user edits possible on edit and add pages.]
This seems to cause problems when adding or editing records, because these fields are then apparently not added to the application logic (i.e. when NOT checked "on" for the Add and Edit pages). Adding "date("Y-m-d H:i:s")" or "CurrentUserId()" to the default value simply does NOT work.
Using Auto-Update_Value is NOT appropriate for Record_Added and Record_Added_By fields because they should NOT update during an EDIT.
Furthermore, using Auto-Update_Value for Record_Modified_By (where it is appropriate to fire for each edit) doesn't work -- probably because the field is not displayed on the edit page (see #2 above).
Presumed solution:
It seems I should be able to add some code to "Server Events; Table-Specific; Add/Copy Page; Page_Load" or similar, but nothing I do results in anything but errors.
Webmaster's response at
http://www.hkvforums.com/viewtopic.php? ... y+add+user
seems partially on point, but I am still lost.
Any help would be truly appreciated.