I have some sql code:
$id = "2000";
$model = $_GET["model"]
$result = mysql_query("SELECT
Left(Right(Base.inputs.Data_inf,4),3) As 'Datas',
count(Base.Data.Data_ID) As `U_Count`
FROM
Base.Data
WHERE
Product = '$id'
AND model in ('a','b','c')
GROUP BY ");
I would like to make AND part of query to be dynamic. Something like this:
$m= $model;
switch ($m)
{
case "basic":
$m = "AND model in ('a','b','c')";
break;
case "upgrade":
$m = "AND model in ('d','e','f')";
break;
default:
$m = "AND model in ('a','b','c')";
}
I put $m in the query and it doesn't work:
WHERE
Product = '$id'
'$m'
Any suggestion will be appreciated.