Error with select query use 's (Atrophy)
I am trying to select data from mysql database.
$sql= "select * from category where Name = 'Jam's Airport Review' ";
this give me error
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 's Airport Review'' at line 1
How i access query with out error.
mysql_real_escape_string() or better yet, read up on prepared statements offered by mysqli or pdo.
I think that the problem is that the query is reading it like this
$sql= "select * from category where Name = 'Jam'
and it is down to the ' you will need to escape the ' character in Jam's for the query to read and that is why you may want to look at real_escape_string
Hope that helps