I want to perform a SELECT query with conditions which are filled dynamically.
if($_POST['a']=='true'){
$a = 'a,';
$a_where = 'a >0';
}
if($_POST['b']=='true'){
$b = 'b,';
$b_where = 'b >0';
}
if($_POST['c']=='true'){
$c = 'c,';
$c_where = 'c >0';
}
Than i was tring to make WHERE
$where = 'WHERE '.$a_where.' OR '.$b_where.' OR '.$c_where;
And query
$query = mysql_query('SELECT id,'.$a.$b.$c.'date FROM t_name '.$where.' ORDER BY date DESC');
Problem is if b
or a
is not POST than i have error in query. Actualy only WHERE clause is problem here.