Impossibility: Error in SQL context near line 4

Today two of my PHP pages suddenly started producing the following error:

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 ‘’ at line 4

I have not changed this particular code for a while so I decide to swap out the query on the PHP page with the following one, and still get the error:

select * from users limit 10;

Any idea why I’m getting this error even when such a simple query is used? And why is it making reference to line 4, when my query is no longer multiple lines?

Thanks!

No WHERE ?

Correct. No where clause at all with the new simple query I’m using in the PHP code, and yet I still get the error mentioned above. Also, this is happening on two separate PHP pages. Could it be something wrong with the mySQL server?

Have you tried tried to run the query separately? Most likely there’s something wrong with your page code since the query should run with no problems by itself. Look for missing or extra quotes, brackets etc.

1 Like

Yes, the original query on the PHP page works fine when run in the mySQL client I use called Querious.

sounds like a php problem, maybe passing garbage to mysql, hence the location of the error message “near ‘’” i.e. end of alleged sql statement