-1

i am writing this command

$result = mysql_query("SELECT * FROM register where name= ‘lakhan’ ") or die(mysql_error());

and when running the php file it shows:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '‘lakhan’' 

I am using MySql Server 5.5 AND INSTEAD OF = sign i have used LIKE also in query then too error is coming.Please help me to resolve it

Jens
  • 67,715
  • 15
  • 98
  • 113
Ram Somani
  • 231
  • 3
  • 12

1 Answers1

0

Use single quotes arround the value:

$result = mysql_query("SELECT * FROM register where name= 'lakhan' ") or die(mysql_error());

Do not longer use the deprecated mysql_* API. Use mysqli_* or PDOwith prepared statements.

Jens
  • 67,715
  • 15
  • 98
  • 113