![]() |
Alexey admin 6/26/2006 |
Chris, |
O
|
osluk author 6/26/2006 |
Chris, you can capture the values entered by the user on Add and Edit pages by accessing $values array in Before record added and Before record updated events.
|
![]() |
Alexey admin 6/27/2006 |
Chris, |
O
|
osluk author 6/27/2006 |
I have this working (the details are captured into the audit table) |
O
|
osluk author 6/27/2006 |
function BeforeAdd(&$values) { // Parameters: // $values - Array object. // Each field on the Add form represented as 'Field name'-'Field value' pair //** Save new data in another table **** global $conn,$straudit; $strSQLSave = "INSERT INTO audit ('Details','Detail_1') values ("; $strSQLSave .= $values['Ref','Appellation']; $strSQLSave .= ")"; db_exec($strSQLSave,$conn); return true; // return true if you like to proceed with adding new record // return false in other case }
Parse error: syntax error, unexpected ',', expecting ']' in /hsphere/local/home/bauduc-dev/bordeauxreport.com/db-2005/AdminC/include/data_events.php'>bordeauxreport.com/db-2005/AdminC/include/data_events.php'>bordeauxreport.com/db-2005/AdminC/include/data_events.php'>bordeauxreport.com/db-2005/AdminC/include/data_events.php on line 34 Parse error: syntax error, unexpected ',', expecting ']' in /hsphere/local/home/bauduc-dev/bordeauxreport.com/db-2005/AdminC/include/data_events.php'>bordeauxreport.com/db-2005/AdminC/include/data_events.php'>bordeauxreport.com/db-2005/AdminC/include/data_events.php'>bordeauxreport.com/db-2005/AdminC/include/data_events.php on line 34
$strSQLSave .= $values['Ref','Appellation'];
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 } function BeforeAdd(&$values) { // Parameters: // $values - Array object. // Each field on the Add form represented as 'Field name'-'Field value' pair //** Save new data in another table **** global $conn; $strSQLSave = "INSERT INTO audit (Details,Detail_1) values ("; $strSQLSave .= $values['Ref','Appellation']; $strSQLSave .= ")"; db_exec($strSQLSave,$conn); return true; // return true if you like to proceed with adding new record // return false in other case }
Final version removed to stop the error Parse error: syntax error, unexpected ',', expecting ']' in /hsphere/local/home/bauduc-dev/bordeauxreport.com/db-2005/AdminC/include/data_events.php'>bordeauxreport.com/db-2005/AdminC/include/data_events.php'>bordeauxreport.com/db-2005/AdminC/include/data_events.php'>bordeauxreport.com/db-2005/AdminC/include/data_events.php on line 34 I can ftp straight into data_events.php and get it working just by removing this code - which must be getting closer - ??!!! function BeforeAdd(&$values) { // Parameters: // $values - Array object. // Each field on the Add form represented as 'Field name'-'Field value' pair //** Save new data in another table **** global $conn; $strSQLSave = "INSERT INTO audit ('Details','Detail_1') values ("; $strSQLSave .= $values ['Ref','Appellation']; $strSQLSave .= ")"; db_exec($strSQLSave,$conn); return true; // return true if you like to proceed with adding new record // return false in other case } |