I have 4 PHP variables, each variable consists of dynamic checkboxes, sometimes it can be one variable sometimes more but not more than 4:
$type = 'type_id = 2';
$color = 'color_id = 3';
$man = 'man_id = 5';
$size = 'size_id = 4 or size_id = 5';
I need to form of these variables Mysql query, the problem is how to add WHERE and AND strings before each variable. In front of first variable I need to add WHERE (it can be $type or $color or other). If first variable is active and other is checked I need to add AND to form proper query. e.g
if checked only "type" checkboxes:
WHERE $type
if checked "size" and "type" checkboxes:
WHERE $size AND $type
and so on... Hope you understand my problem, sorry for bad english.