Forum Moderators: coopster
I'm using a set of if(isset) like this:
if(isset($_GET['x'])){
$x=$_GET['x'];
$whereclause=$whereclause . 'AND' . "x=$x";
}
So what should $whereclause be started as so everything will come up if no variables are defined?
Also for one of them I just want it to contain the letters. for this one my column is called BodyStyle. and it can be "Truck (4 Door Extended Cab)" or "Truck (4 Door Crew Cab)" but if I put in Truck I want to pull both of these. Would I use 'WHERE BodyStyle LIKE 'Truck'?
[edited by: Sarah_Atkinson at 6:44 pm (utc) on April 25, 2008]
$where = 'WHERE 1=1';
if (isset($_GET['x'])) {
$x = mysql_real_escape_string [php.net]($_GET['x']);
$where .= " AND x = $x";
}