O
|
osluk author 6/27/2006 |
Hey guys I know someone answered this in the lost posts before I could get it working. |
![]() |
Alexey admin 6/27/2006 |
Chris, global $conn,$strTableName; $strSQLSave = "INSERT INTO AnotherTable (User, Time, Field1, Field2) values ("; $strSQLSave .= "'".$_SESSION["UserID"]."',"; $strSQLSave .= "ADDTIME(now(),'07:00:00'),"; $strSQLSave .= $values["Field1"].","; $strSQLSave .= $values["Field2"]; $strSQLSave .= ")"; db_exec($strSQLSave,$conn); |
O
|
osluk author 6/27/2006 |
Error type 256 |
![]() |
Alexey admin 6/27/2006 |
Here is the fixed code function BeforeAdd(&$values) { // Parameters: // $values - Array object. // Each field on the Add form represented as 'Field name'-'Field value' pair //** Insert a record into another table **** global $conn; $strSQLSave = "INSERT INTO AnotherTable (`User created`,`Record added`) values ("; $strSQLSave .= "'".$_SESSION["UserID"]."',"; $strSQLSave .= "ADDTIME(now(),'07:00:00')"; $strSQLSave .= ")"; db_exec($strSQLSave,$conn); return true; // return true if you like to proceed with adding new record // return false in other case } |
O
|
osluk author 6/27/2006 |
Alexa you are a star, function BeforeEdit(&$values, $where) { // Parameters: // $values - Array object. // Each field on the Edit form represented as 'Field name'-'Field value' pair // $where - string with WHERE clause pointing to record to be edited global $conn; $strSQLSave = "INSERT INTO data (`User modified`,`Record modified`) values ("; $strSQLSave .= "'".$_SESSION["UserID"]."',"; $strSQLSave .= "ADDTIME(now(),'06:00:00')"; $strSQLSave .= ")"; db_exec($strSQLSave,$conn); return true; // return true if you like to proceed with editing this record // return false in other case }
|
O
|
osluk author 6/28/2006 |
I have relaised that rather than data stamping the existing record I am creating a new record for each time the user and time are captured. Removed from Table events -> Add page -> Before record added function BeforeAdd(&$values) { // Parameters: // $values - Array object. // Each field on the Add form represented as 'Field name'-'Field value' pair //** Insert a record into another table **** global $conn; $strSQLSave = "INSERT INTO data (`User created`,`Record added`) values ("; $strSQLSave .= "'".$_SESSION["UserID"]."',"; $strSQLSave .= "ADDTIME(now(),'06:00:00')"; $strSQLSave .= ")"; db_exec($strSQLSave,$conn); return true; // return true if you like to proceed with adding new record // return false in other case } Removed from Table events -> Edit page -> Before record added function BeforeEdit(&$values, $where) { // Parameters: // $values - Array object. // Each field on the Edit form represented as 'Field name'-'Field value' pair // $where - string with WHERE clause pointing to record to be edited global $conn; $strSQLSave = "INSERT INTO data (`User modified`,`Record modified`) values ("; $strSQLSave .= "'".$_SESSION["UserID"]."',"; $strSQLSave .= "ADDTIME(now(),'06:00:00')"; $strSQLSave .= ")"; db_exec($strSQLSave,$conn); return true; // return true if you like to proceed with editing this record // return false in other case }
|
O
|
osluk author 6/28/2006 |
Would love someone to look at the details here the concept is sound so as long as it is possible to add data to the same record this should be doable!
|
O
|
osluk author 6/29/2006 |
Located in Table events -> Add page -> Before record added function BeforeAdd(&$values) { // Parameters: // $values - Array object. // Each field on the Add form represented as 'Field name'-'Field value' pair //** Insert a record into another table **** global $conn; $strSQLSave = "INSERT INTO data (`User created`,`Record added`) values ("; $strSQLSave .= "'".$_SESSION["UserID"]."',"; $strSQLSave .= "ADDTIME(now(),'06:00:00')"; $strSQLSave .= ")"; db_exec($strSQLSave,$conn); return true; // return true if you like to proceed with adding new record // return false in other case } Located in Table events -> Edit page -> Before record updated function BeforeEdit(&$values, $where) { // Parameters: // $values - Array object. // Each field on the Edit form represented as 'Field name'-'Field value' pair // $where - string with WHERE clause pointing to record to be edited global $conn; $strSQLSave = "INSERT INTO data (`User modified`,`Record modified`) values ("; $strSQLSave .= "'".$_SESSION["UserID"]."',"; $strSQLSave .= "ADDTIME(now(),'06:00:00')"; $strSQLSave .= ")"; db_exec($strSQLSave,$conn); return true; // return true if you like to proceed with editing this record // return false in other case } |
![]() |
Alexey admin 6/29/2006 |
Chris, |
O
|
osluk author 6/29/2006 |
Thanks Alexa looks like I have run out of offical goodwill!
|
A
|
Alan4573 6/29/2006 |
Chris, |
O
|
osluk author 6/29/2006 |
Thanks Alan, |
A
|
Alan4573 7/12/2006 |
Thanks Alan, The reason it is displayed is for admin only. There is a different view for the public. Just allows me to sort by the field and when a users messes up I can see exactly where they jave been! Cheers Chris
|