I haven't had to do Php in about 5years and I'm having some trouble doing the simplest task.
I use Javascript to send some parameters from a querystring to my page and so some may be 'undefined'
I want to build a mySQL query based on these parameters, therefore need to skip those that are 'undefined'
I can't seem to get this to work properly..any help would be appreciated.
$WhereClause = "";
if (isset($_REQUEST['lname']) && $_REQUEST['lname'] === 'undefined')
{
$WhereClause .= " surname like \"%$lname%\"";
}
$query = "SELECT * from foo
" . $WhereClause . "
LIMIT $start, $pagesize";