Forum Moderators: coopster
I store all the restaurant names in the database that contain an apostrophe like this:
"John's Restaurant" is stored in the MySql database like "John's Restaurant"
But when people search for the restaurant without the apostrophe "Johns Restaurant" then the restaurant "John's Restaurant" is not matched/returned.
Is there a way to get around this problem?
SELECT * FROM table WHERE REPLACE(name,'\'','')' LIKE '$name';
Think that might work ok.
dc
if so you'll need:
1) save without quotes in database
or
2) remove quotes in SQL statement when comparing.
#2 is slow since it will not be able to use index
#1 would work fast but problems if you output the same field to user (it would be without quotes). Maybe save both texts, one with stripped ' for search, one non-stripped for display