This topic is locked

Help Events after record

12/24/2007 3:39:30 AM
PHPRunner General questions
U
uzu1302 author

Help please!!!!
I thought this would be easy but I am obviously doing somethng quite wrong!!
I have two table
Fournisseur Master - Field Id_Num .....

Actions Détail - Field Id_Num, AC_Num, Ac_Date, Ac_Action
When I add a new record to Fournisseur I would like to add new record to Action Ac_Date the current date and Ac_Action with text "Création".
I have set the after record added event with the script
// Parameters:
// $values - Array object.
// Each field on the Add form is represented as a 'Field name'-'Field value' pair
// $keys - Array object with added record key column values
//** Insert a record into another table ****

global $conn, $date, $action;

$strSQLInsert = "insert into actions (Ac_Date, Ac_Action) values ($date, $action)";
$date = date("l/m/Y");
$action = "Création";
db_exec($strSQLInsert,$conn);
After

PHP error happened
Technical information

Error type 256

Alexey admin 12/24/2007

Hi,
character and date values should be enclosed in quotes in SQL.

Try using this line in your code:

$strSQLInsert = "insert into actions (Ac_Date, Ac_Action) values ('$date', '$action')";

U
uzu1302 author 12/25/2007

Hi,

character and date values should be enclosed in quotes in SQL.

Try using this line in your code:


Hello, Thank you for your help, another question: how I get back the variable Id_Num of the file "fournisseur" for the transfer in the field Id_Num of the file "actions"

Thank you merry Christmas

J
Jane 12/28/2007

Hi,
value of Id_Num field is in the $keys array in the After record added event:

$keys["Id_Num"]