SELECT p.id
FROM _gcontests_photos p
LEFT JOIN _gcontests_serial s ON s.id=p.serial_id
WHERE p.contest_id=
AND p.category_id=
AND p.stage >= 0
ORDER BY p.id DESC 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.category_id=
AND p.stage >= 0
ORDER BY p.id DESC' at line 5