[SIZE=13px] [h=2][/h]
[/SIZE]
[SIZE=13px] Am trying to update another table with this code below…
/**
- Update a record on another table
*/
// SQL statement parameters
$update_table = ‘advance’; // Table name
$update_where = “advance_id = ‘{advance_id}’”; // Where clause
$update_fields = array( // Field list, add as many as needed
“amount_advanced = {advance_balance}”,
//“field_2 = ‘new_value_field_2’”,
);
// Update record
$update_sql = ‘UPDATE ’ . $update_table
. ’ SET ’ . implode(’, ', $update_fields)
. ’ WHERE ’ . $update_where;
sc_exec_sql($update_sql);
But I get this error below when I this code in OnAfterInsert area:
Error while accessing the database:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘WHERE advance_id = ‘3’’ at line 1
[/SIZE]