SQL SELECT statement help

wxdqz

New Member
Hi guys,

I am having trouble with the following SELECT statement using MySQL:

$sql = "SELECT * FROM products WHERE picture IS NOT NULL AND WHERE cat_id='405' OR cat_id='416' OR cat_id='418' OR cat_id='420' OR cat_id='430' OR cat_id='440' OR cat_id='510' OR cat_id='580' OR cat_id='605' OR cat_id='730' OR cat_id='792' ORDER BY rand() LIMIT 4";

Basically, it ignores the IS NOT NULL statement and sends me all the results, but I really just want the results where there is something in the picture column and also from one of those categories.

any ideas?

Thanks,
Zac
 
Back
Top