Error: Query Failed:S::MySQL error 666: 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 'S' at line 1 and the query I posted was from a $var = QUERY die($var), so that is the query that is running through php. Php is running it with a mysql_query()