I have a small piece of code that I cannot get to execute for a name has ' in it. ie... O'Reilly. So when it executes it skips over people with apostrophe's in their names. Is there a way to escape it to where it will not skip them?
function direct_reports($email) {
db_set_active('database');
$result = db_query("select COUNT(u.username) AS reports
from {reports_user_info_fields_summary} u
WHERE u.email = '$email' AND u.deleted = 0 ");
$record = $result->fetchAssoc();
db_set_active();
return $record;
dpm($record, 'record');
}
Please help and thank you!!! This is not a repeat of the SQL injection prevention, the info already is stored in the DB with the character.. now calling it, it still wont escape the character.. I have tried mysql_real_escape_string (PHP 5.4), I just cannot get that piece of code above to pull an email with an apostrophe..
The DB is halting on a email that is myname.o'myname@email.com (no slashes)