Question
problems with single quotes in full text search
hi:
PHP+MySQL
i'm having problems when the user types single quotes in the search field
Parse error: syntax error, unexpected ')' in
/Users/Manager/Sites/xxx/html/results.php on line 5
line 5: $keywords = $_GET['keywords']);
so, i used the addslashes function to escape the quotes:
$keywords = addslashes($_GET['keywords']);
now i'm receiving a SQL syntax error if you type for example macy's:
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') AND
lang = 'en' ORDER BY full_name' at line 1
$qs = "SELECT m_id,full_name FROM media ";
$qs .= "WHERE MATCH(biblio) AGAINST('".$keywords."') ";
$qs .= "AND lang = '".$_SESSION["lang"]."' ORDER BY full_name";
tia,
jdoe
PHP+MySQL
i'm having problems when the user types single quotes in the search field
Parse error: syntax error, unexpected ')' in
/Users/Manager/Sites/xxx/html/results.php on line 5
line 5: $keywords = $_GET['keywords']);
so, i used the addslashes function to escape the quotes:
$keywords = addslashes($_GET['keywords']);
now i'm receiving a SQL syntax error if you type for example macy's:
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') AND
lang = 'en' ORDER BY full_name' at line 1
$qs = "SELECT m_id,full_name FROM media ";
$qs .= "WHERE MATCH(biblio) AGAINST('".$keywords."') ";
$qs .= "AND lang = '".$_SESSION["lang"]."' ORDER BY full_name";
tia,
jdoe
