[SQL ] mysql 做 where 条件查询时,用urlencode

楼主: taiwan08 (save the one for all)   2014-05-13 17:45:00
各位前辈大家好,我想请问一下
mysql 在做 where 条件查询时,能不能用urlencode查询
现在我的问题在DB里的资料是 utf8_unicode_ci编码,
在phpmyadmin里面看见的资料是显示中文(例如:网络机器人)
但是我想在做查询时,把查询的关键字用 urlencode,
这样我query应该要如何写才能把数据库里面的资料也一起urlencode?
SELECT * FROM table WHERE column LIKE '%".urlencode($string)."%'
在字段那边可以跟着用urlencode吗?
谢谢大家指教
P.S.手机发文,排版若造成不适请见谅
作者: bency (林班西)   2014-05-14 00:56:00
在存进去的时候就要 urlencode 了,存什么进去就是找什么
楼主: taiwan08 (save the one for all)   2014-05-15 16:46:00
所以除了改变数据库的结构外,就没有其他的办法了吗@@
作者: TeemingVoid (TeemingVoid)   2014-05-18 00:36:00
urldecode()还原后,再查资料。

Links booklink

Contact Us: admin [ a t ] ucptt.com