removing hyphen from search string
Posted: Fri Sep 21, 2007 5:26 am
Hi guys,
I've been having some major problems with a script I'm developing which basically queries the database using a SELECT statement. The trouble is some of the entries contain hyphen's and this is letting strings past which should have been found in the database.
I've tried replacing the character beforehand using str_replace() and used addslashes() and mysql_real_escape_string() but to no avail. I've just read up a bit on Regex and I was just wondering is there any way I can use this to achieve the result I'm after.
Here's the SQL below (you'll appreciate why I'm tearing my hair out):
Can anyone help at all?
Thanks for reading.
I've been having some major problems with a script I'm developing which basically queries the database using a SELECT statement. The trouble is some of the entries contain hyphen's and this is letting strings past which should have been found in the database.
I've tried replacing the character beforehand using str_replace() and used addslashes() and mysql_real_escape_string() but to no avail. I've just read up a bit on Regex and I was just wondering is there any way I can use this to achieve the result I'm after.
Here's the SQL below (you'll appreciate why I'm tearing my hair out):
Code: Select all
$sql = "SELECT * FROM categories_description WHERE categories_name = '" . $section . "'";Thanks for reading.