Tsukiyomi Posted May 7, 2008 Share Posted May 7, 2008 I've tried two different queries. The first one does not work, but the second one does. The only difference I can see between the two is the single quote in the first statement. For whatever reason the LIKE statement doesn't seem to be working when the string contains and escaped single quote. query = SELECT * FROM tablename WHERE (business LIKE '%Angel\'s daycare%' AND category LIKE '%In Home Daycare%' ) AND (status = '1' AND status_2 = '1') LIMIT 0, 10 query = SELECT * FROM tablename WHERE (business LIKE '%Obie Family Daycare%' AND category LIKE '%In Home Daycare%' ) AND (status = '1' AND status_2 = '1') LIMIT 0, 10 Is there any workaround for this? Quote Link to comment Share on other sites More sharing options...
fenway Posted May 7, 2008 Share Posted May 7, 2008 That statement would work from the command line... so it's a quoting issue with php... my guess is that you're using single quotes for the entire query literal? Quote Link to comment Share on other sites More sharing options...
Tsukiyomi Posted May 7, 2008 Author Share Posted May 7, 2008 I believe so. So what would I do differently to get this to work? Quote Link to comment Share on other sites More sharing options...
Tsukiyomi Posted May 7, 2008 Author Share Posted May 7, 2008 Never mind I solved it. Since Angel's daycare was stored like this in the database "Angel\'s Daycare" (since I escaped the quotes in the insert query) I had to escape the quote twice this time so it would look literally for "Angel\'s Daycare". Thanks for the help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.