select p.*,pt.class from product_photo p LEFT JOIN product_photo_type pt ON p.photo_type = pt.id LEFT JOIN product_supplier ps ON p.company_id = ps.id WHERE p.active = "1" and p.company_id= and p.id<>173 order by rand()
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'and p.id<>173 order by rand()' at line 1