there is a problem with my MySQL query. I have a table with one of the columns “read” where the values are “1” by default and is automatically set to tinyint(1) by phpmyadmin instead of bool.
When I perform a query:
SELECT * FROM book WHERE read = '1'
It gives an error.
But when I perform this query:
SELECT * FROM book WHERE id = '77'
It is fine. I don’t see any problem except that maybe tinyint cannot be searched that way. Can someone please help? I’ve travelled across google but found no answers.
just remove the quotes
as it is tinyint you should not use quote (use them for strings or characters or dates)
if it doesn’t work then you can do casting as mentioned by Ilion ( it’s good )