Escape Chars
Posted: Wed Dec 05, 2007 10:18 pm
I have a very strange query to run for Search Friendly URLs. My search string is "mens" which was converted from the actual title "men's". I want to compare it with a record in the database which has the data set to "Men's". So I'm making the MySQL column to replace a few characters that I remove in the search string so that the compare is the same.
In other words, a record is Men's Ministry. I convert it to use in a URL making it "mens-ministry" and it is requested by another page and then queried back to the same database table (where it is in its original form and must be converted in order to accurately be compared).
So here is my query:
It is not working and I believe it is due to the escape character next to the apostrophe. I think that PHP thinks it should escape. This is the echo of the query:
Any ideas on how to resolve this?
In other words, a record is Men's Ministry. I convert it to use in a URL making it "mens-ministry" and it is requested by another page and then queried back to the same database table (where it is in its original form and must be converted in order to accurately be compared).
So here is my query:
Code: Select all
$query_PgDetails = "SELECT * FROM ec_Pages WHERE levelID=1 AND REPLACE(REPLACE(REPLACE(LCASE(pg_Title),' ','-'),'\'',''),'\"','')='".$ec_Page."'";Code: Select all
SELECT * FROM ec_Pages WHERE levelID=1 AND REPLACE(REPLACE(REPLACE(LCASE(pg_Title),' ','-'),'\'',''),'"','')='mens-ministry'