Hi,
I have a control form with a checkbox filed on it. The user can select multiple values. How can I update those values using a single query.
The update query code that Scriptcase provides (show below) doesn’t work past the second selected value.
/**
* Update a record on another table
*/
// SQL statement parameters
$update_table = 'my_table'; // Table name
$update_where = "databasefield = {checkboxfield}"; // Where clause
$update_fields = array( // Field list, add as many as needed
"field_1 = 'new_value_field_1'",
"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);
Any help would mean a lot.