SELECT with ' in search term

[email protected] ("Ron Piggott")
Newsgroups php.db
Message-ID <f6c23d6763ed2b24467e8e6c96c7c2dd.squirrel@www.theverseoftheday.info>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.