![]() |
hichem 1/3/2009 |
I have a user table with userID and UserName in. I have another table containing records that I want to automatically update with the logged in person adding the record or updating it. I've tried using a read only text field with the default value set to $_SESSION["UserID"] and the datefield, again a Readonly text field, default value set to now(). The tables are linked on the datasource tables view - but I get strange results. I basically have 4 fields I want to update automatically: On adding a record I want to update Submitted By Updated by with the current logged in person and Sudmitted Date and Updated Date to be the current time. When the record is edited I only want the Updated By / Updated Date to change. I can't get it working, should I put the data in code and how can I get it to display then name instead on a number. Sometimes it displays the name in one view but not in another.. Any suggestions greatfully received.
|
J
|
Jane 1/5/2009 |
Hi, $values["Submitted By"] = $_SESSION["UserID"]; $values["Sudmitted Date"] = now();
|
W
|
wypman author 1/30/2009 |
Hi, use Before record added and Before record updated events to update these fields. Here is a sample: Username of current user is stored in the $_SESSION["UserID"] variable.
|