Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql not giving Syntax error when it should

I am trying with following query

SELECT COUNT(*) 
  FROM users` 
  WHERE email = '[email protected]'

This is not giving me syntax error (notice not include ` character at the starting of table name). And always gives me count as 1, although record in not there in db.

I will get the error if i remove COUNT from the query.

Hope this is not a bug in mysql.

like image 579
jimy Avatar asked Mar 23 '26 19:03

jimy


1 Answers

The backtick seems to be commenting out the rest of the line.

I can't say why but I have tested it (through phpMyAdmin) and that it the case.

like image 137
Brendan Bullen Avatar answered Mar 25 '26 13:03

Brendan Bullen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!