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):
Everytime I examine a $section I want to query this to categories_name and, if there are no other entries, insert that into categories_name, but so far the example above would insert both $section strings (since they contain a hyphen).