Failed to prepare statement SELECT DISTINCT rates.rateindex FROM rateseqn INNER JOIN rates ON rates.baserate=rateseqn.rateindex WHERE eqnShort like 'o14(a,p)f17%' AND ratePrivate=0 AND version=1AND garbage = 0 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 'garbage = 0' at line 1