Error Keep Prompt

IS my syntax correct?

/**

  • Check for an existing record
    */

// SQL statement parameters
$check_table = ‘loancompmaster’; // Table name
$check_where = “PartNo = ‘[glo_id]’ && Branch = ‘{BranchReq}’”; // Where clause

// Check for record
$check_sql = ‘SELECT *’
. ’ FROM ’ . $check_table
. ’ WHERE ’ . $check_where;
sc_select(dataset, $check_sql);

if (false == {dataset})
{
sc_error_message(Error Found!!!);
}
elseif ({dataset}->EOF)
{
$insert_sql = ‘insert into loancompmaster (PartNo,PartDesc,Branch,Qty)’
. ‘values(’[glo_id]’,’[glo_desc]’,’{BranchReq}’,’{LoanQty}’)’;

sc_exec_sql($insert_sql);

}
else
{
$current_qty = $dataset->field[5];
$inv_qty = $current_qty + {LoanQty};
}

sc_error_message(‘Error Found!!!’); -> with quotes or double quotes please

HI rr,

with or without the quotes i also able to generate the error message. I found that i not able to use global variable directly into my sql query, i need to assign it to local variable. Any advice?

$insert_sql = ‘insert into ‘. $check_table.’(PartNo,PartDesc,Model,Branch,Qty)’
.‘values(’.$partnoloc.’,’.$partdescloc.’,’.$modelloc.’,’.{BranchReq}.’,’.{LoanQty}.’)’;

sc_exec_sql($insert_sql);