开发者

&amp shown in url column in mysql. Display as stored in mysql

I have a url that is displayed as this : http://www.amazon.com/gp/product/0307408418/ref=s9_al_bw_ir01?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-3&pf_rd_r=0ZHX172F5RRJXR7D5EKD&pf_rd_t=101&pf_rd_p=1313842642&pf_rd_i=283155

What happens though is when I try to use the original url string in an sql query, I get an empty set. It is lar开发者_C百科gely do due to the url encoded differently. I wanted to know then, how could I update the url string to properly query the database?


Maybe try using htmlspecialchars():

'SELECT * FROM tablename WHERE url = ' . htmlspecialchars($originalUrl);

htmlspecialchars should replace special characters in your URL with the HTML char code equivalent

For more info: http://www.php.net/manual/en/function.htmlspecialchars.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜