SELECT with ' in search term
| From: | Ron Piggott | Date: | Fri, 13 Aug 2010 03:26:23 +0000 |
| Subject: | SELECT with ' in search term | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-47302@lists.php.net to get a copy of this message | ||
If the variable $segment has an ' in it the $query won't work because of
having 3 ' 's.
Should I be using:
$segment = mysql_real_escape_string($segment);
before querying the database?
$query="SELECT
reference FROM bible_concordance_words WHERE
word =
'$segment' LIMIT 1";
Please note: $segment wasn't submitted through a form.
Thanks.
Ron