add new record inserting new

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Aburajeh
User
Posts: 37

add new record inserting new

Post by Aburajeh »

i have table "EVENTS" i am want make every table when add new record inserting New add in event records am try this code but not work

$sInsertSql = ew_Execute("INSERT INTO events (Tag, user, Description, table, key, Procedure_Type, Date, Script) VALUES ('0', '"CurrentUserID()"', '"ADD NEW RECORDS"','".$rsnew['table']."', '" .$rsnew['AutoNumber']."', '"1"', '"ew_CurrentDateTime()"', '".$rsnew['Script']."')");
$GLOBALS["conn"]->Execute($sInsertSql);

thank you


scs
User
Posts: 694

Post by scs »

ew_Execute() will return the RESULT after execute. For you case is True or False.

$GLOBALS["conn"]->Execute($sInsertSql); // Why you want to execute the true or false?

Your syntax is incorrect. Please check your error_log file.
Aburajeh wrote:
"INSERT INTO events (Tag, user, Description, table, key, Procedure_Type, Date, Script)
VALUES ('0', '"CurrentUserID()"', '"ADD NEW RECORDS"','".$rsnew['table']."', '"
.$rsnew['AutoNumber']."', '"1"', '"ew_CurrentDateTime()"', '".$rsnew['Script']."')");

Mind the "Insert ......'"CurrentUserID()"'
At least you need to modify some of them to "Insert......'". CurrentUserID() ."'......

If you really need to have ", then make it like \"


mobhar
User
Posts: 11752

Post by mobhar »

As scs mentioned above, you don't need to run this following code anymore:

$GLOBALS["conn"]->Execute($sInsertSql);

if you have already executed the INSERT INTO SQL statement using "ew_Execute()" global function.

You may run this code:
$GLOBALS["conn"]->Execute($sInsertSql);

only if "$sInsertSQL" variable contains the INSERT INTO SQL, not just like your code above.


Post Reply