Tjazz Tjazz - 1 month ago 5x
SQL Question

Unknown column '<name>' in 'where clause'

I have a connection with a database table, called user, where I want to get the text from "todo". But I keep getting an "unknown" error.

This is the Code I have so far:

"SELECT `todo` FROM `user` WHERE `username` LIKE `" + _name+ "`"

Note: I'm a starter with sql, so please be specific.


Table name and column name only enclosed by backticks not for string values .so remove backticks in where clause near like and add single quotes for string values.

"SELECT `todo` FROM `user` WHERE `username` LIKE '" + _name+ "'"