I am trying to construct an SQL statement with two string parameters. Essentially I am querying a MS Access table with php.
Is my syntax correct below?
$parm1 = "TPMS";
$parm2 = "Clamp In";
$sql = "SELECT * FROM archive where productfamily like ".$parm1 ."and where productderivative like". $parm2;
Now I have tried a one parameter string called $parm1, The syntax of the string is as below. Please note this is a MS Access table I am querying with php.
$parm1 = "'TPMS'";
Now the corresponding MS Access SQL statement is as follows which works:
$sql = "SELECT * FROM archive where productfamily like $parm1 order by fullname asc"
Now the corresponding MS Access SQL statement with two parameters which does not work. Can somebody tell me why the second parameter does not work in the SQL statement? Is it perhaps my syntax?
$sql = "SELECT * FROM archive where productfamily like $parm1 and "
$sql .= "where productderivative like $parm2 order by fullname asc";