After breaking my head with my code finally using inspect, I found some issues.
I am using a form with multirecords. I am using the Where Clause in the form / SQL. The clause is “customer_id_from_master = [cust_row_id]”. I am setting the [cust_row_id] as a global in the same form’s applicationinit event as follows
$cust_row_id=0;
$idProduct=0;
sc_set_global ([cust_row_id]);
sc_set_global ([idProduct]);
The following if check was added after the error cropped out . But still the same error
if(isset([cust_row_id])==false)
{
[cust_row_id]=0;
}
Whatever be the case, I am getting this error found using INSPECT in CHROME:
$(function() {
scAjaxShowErrorDisplay_toast(“table”, scAjaxFixedErrorSql(“Error while accessing the database<BR>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘’ at line 1<BR>{SC_DB_ERROR_INI}View SQL{SC_DB_ERROR_MID}SELECT count(*) AS countTest from customer_wishlist where customer_id_from_master = {SC_DB_ERROR_CLS}Close{SC_DB_ERROR_END}”));
})
This error goes away when I remove the Where Clause value in settings
Now the issue can be any one of the following
- Not to use Global Variables in the where clause. If that is the case then how to filter the records in the form / multiple record
- Application Init Does not get executed before the SQL is executed (AM I missing something here )
THE HELP OF APPLICATIONINIT Says "This event occurs before the application execute the SQL, and execute only once. It is used to do verification of variables, and security verification. Ex: if ([glo_var_department] != ‘financial’){ sc_redir(app_x.php); "
IF both above are ok, then I am making mistake somewhere or there is a bug in SC?
Suresh