Update another table from a form not working?

It has been sometime since I can no longer update my scriptCase, it says it is outdated but the updates don’t take for some reason: I now have a problem and I am not sure it is related.

This is my problem:
I had created a sub-form (Master/Detail) that had been working fine in the past until last night.
The subform has code to update another table and this just to work, today all I get is a “blank screen”, this is the reason I noted my other problem with updating scritpcase, has something changed ???

This is my code:
Subform is based on ‘orders’ table, I need to update another table called ‘clients’
Events -> onBeforeUpdate: In this even I have this code below.

Note that when I comment this block of code the form works but If I take the comments out I get a blank screen. ???

$update_table = ‘clients’; // Table name
$update_where = “cl_id = ‘{or_cl_id}’”; // Where clause
$update_fields = array( // Field list, add as many as needed
“cl_status = ‘{or_status}’”
);

$update_sql = ‘UPDATE ’ . $update_table
. ’ SET ’ . implode(’, ', $update_fields)
. ’ WHERE ’ . $update_where;
sc_exec_sql($update_sql);

Javascript message parameters
$javascript_title = ‘Updated’; // Javascript message title
$javascript_message = 'Update success!. '; // Javascript message contents
Display javascript message
sc_ajax_message($javascript_message, $javascript_title);

Re: Update another table from a form not working?

I am not sure what is happenning, sometimes it works, sometimes it does NOT.

Re: Update another table from a form not working?

PHP display a blank screen sometimes and the page is with an error and stop processing.

You could find in the apache logs or try to debug(putting an echo before sc_exec_sql with the variable $update_sql. Could be sql … with wrong syntax depending of the contents of the variables $update_table/implode(’, ', $update_fields)(if a value contains a single quota, will break the sql syntax. … dont know. only debugging.