SELECT COUNT(id) AS nr FROM drama_titles WHERE category= AND SUBSTRING(title,1,1) = 'E' AND active=1 ORDER BY date DESC;You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND SUBSTRING(title,1,1) = 'E' AND active=1 ORDER BY date DESC' at line 1