CHECK FOR AN EXISTING RECORD

Hello , how can i add multiple where conditions in this script? like $check_where1,$check_where2,$check_where3 and combine them? :((( and the conditions are variables… i have problem with single and double quotes_ how can i make easy?

$check_where1 = “field = ‘$condition1’”;
$check_where2= “field = ‘$condition2’”;
$check_where3 = “field = '$condition’3”;

/**

  • Check for an existing record
    */

// SQL statement parameters
$check_table = ‘my_table’; // Table name
$check_where = “field = ‘condition’”; // Where clause

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

Look, I made some control application that generates the SQL code dynamically, but it depends on the target app, when I execute the control app it opens a blank application, passing the query into a global variable, or you can do it by passing each parameter using POST and then building the query on the target app.

The problem with quotation is resolved by adding the escape character \ after the character that you want to escape. for example ‘mia’s mother’, that is in the database context, and you need to check which is the character escape in your current scheme.

thanks for your reply i have this query but the dataset is always empty. i couldn t find where i made mistake

$sql = “SELECT priv_admin,active,name,email FROM sec_users
WHERE
login =”."’". $slogin ."’".
" AND pswd =". “’” . $spswd . “’” .
" AND site ="."’".$glosite."’" ;

sc_lookup(rs, $sql);

it could be the $pswd hash, try setting that variables with values currently stored in the database.