boywonder
01-16-2003, 12:27 AM
Hi,
this should be simple I think to do it the right way, but it's giving me problems...
I have a form where people can search a members table in several ways, one of which is by typing in last name. So there's 2 members with last name "O'Neal"
The apostrophe was escaped prior to inserting so the names sit in the DB as "O\'Neal"
So... how do I find the match when someone types a search for "O'Neal"
seems to me one of the following should work but they don't...
SELECT * FROM members WHERE lastname = 'O\'Neal'
OR
SELECT * FROM members WHERE lastname = 'O\\\'Neal'
I can find the match by using one of the following:
SELECT * FROM members WHERE lastname LIKE 'O%Neal'
OR
SELECT * FROM members WHERE lastname LIKE 'O__Neal'
but it seems that I should not have to do that... How would I just search for the name without using _ or %
Thanks kindly for any insight.
this should be simple I think to do it the right way, but it's giving me problems...
I have a form where people can search a members table in several ways, one of which is by typing in last name. So there's 2 members with last name "O'Neal"
The apostrophe was escaped prior to inserting so the names sit in the DB as "O\'Neal"
So... how do I find the match when someone types a search for "O'Neal"
seems to me one of the following should work but they don't...
SELECT * FROM members WHERE lastname = 'O\'Neal'
OR
SELECT * FROM members WHERE lastname = 'O\\\'Neal'
I can find the match by using one of the following:
SELECT * FROM members WHERE lastname LIKE 'O%Neal'
OR
SELECT * FROM members WHERE lastname LIKE 'O__Neal'
but it seems that I should not have to do that... How would I just search for the name without using _ or %
Thanks kindly for any insight.