What is wrong with this SQL? [closed]
I've spend good hours trying to fix this one.
SELECT *
FROM `users`
WHERE `IP` = `123.231.213.132`
What is wrong with this?
#1054 - Unknown column '123.231.213.132' in 'where clause'
You should not use backticks with column values. you have to use either single or double quotes otherwise mysql will consider that value as a column name.
SELECT *
FROM `users`
WHERE `IP` = '123.231.213.132'
Use single quotes rather than backtick characters for `123.231.213.132``
SELECT * FROM `users` WHERE `IP` = '123.231.213.132'
Use quotes ' not backticks ` for string literals
What's with the backticks? Use single quotes Also I'm assuming that users is a table name and IP is an entity of users.
Also...you have to end your statement with a semi-colon
It might be the single speach mark symbol. Try replacing them manually.
you are using wrong quotation characters
to specify string value in mysql statement you have to use either '(single quote) or "(double quote)
`(backtick) characters are used to explicitly specify that quoted string represents a field name from where mysql should get the data
backticks are required in your statements if column names are conflicting with mysql's reserved keywords like index
, where
, etc
精彩评论