I have a dynamic drop down that prepopulates from a MySQL database. Of the 600 or so options, a few have an apostrophe, like "Joe's Car". The user is able to select an item from this list which then does a query to pull info for this selection. Obviously this apostrophe is causing a problem and breaks the query if an option is selected like "Joe's Car".
this is the line of code
$query1 = "SELECT * from tblCars WHERE CUSTOMER = '$customer'";
The only thing I have been able to find says to do this -->
$customer = mysql_real_escape_string('$customer');
$query1 = "SELECT * from tblCars WHERE CUSTOMER = '$customer'";
However, it doesn't work, Any input is appreciated.