I try to write a searching engine with php and mysql. Somehow I always get error messages. Here is my code:
$sql = "SELECT * FROM `General` WHERE `Item_Name` LIKE $Name";
TWPUG::資料庫討論區
SQL syntax error.
- The field-name should be put in double-quote. It means case-sensitive.
- The
LIKEonly applies for text-based type field, therefore you need to put content in single-quote. Besides,LIKEmust be used with '%'.