I have a query like this:
$result = mysql_query("SELECT * FROM mytable WHERE some_var = '$db_var' ORDER BY another_var");
I am having trouble because one of my clients tables contains some names with apostrophes in them. I get an SQL error if $db_var contains an apostrophe. How can I fix this without having to change the data in the database?