Question matching text using mysql regexp when the word being searched for has slashes added.
Specific example: "Alzheimer's". In the db, any instance of this will be spelled "Alzheimer\'s" except for maybe a few that somehow snuck in without slashes.
When someone searches for "Alzheimer's", mysql_real_escape_string adds a slash to it before I query the db.
The search comes up empty. Any tips for how to do this?
Code: Select all
$this->sql_query = "SELECT id, segment_name, title, thumbnail, flv, summary, copy, show_number FROM hctv_pages WHERE (title REGEXP '$search_term' OR copy REGEXP '$search_term' OR topic REGEXP '$search_term' OR tags REGEXP '$search_term') AND page_type = 'sub' GROUP BY id ORDER BY show_number DESC ";