带有URL解码的MySQL SELECT [英] MySQL SELECT with URL Decode
本文介绍了带有URL解码的MySQL SELECT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法可以执行MySQL查询,并直接在输出中的列之一中进行urldecode,而不是由PHP来完成.
Is there a way to perform a MySQL query and have one of the columns in the output directly urldecode, rather than have PHP do it.
例如,此表联系人"将包含
For example this table 'contacts' would contain,
------------------------------------
|name |email |
------------------------------------
|John Smith|johnsmith%40hotmail.com|
------------------------------------
SELECT * FROM `contacts`
将输出
约翰·史密斯| johnsmith%40@hotmail.com
John Smith | johnsmith%40@hotmail.com
是否有类似的东西
SELECT name, urldecode(email) FROM `contacts`
要输出,
约翰·史密斯| johnsmith@hotmail.com
John Smith | johnsmith@hotmail.com
推荐答案
在传递给用于JQuery的json_encode之前,我设法使用单独的PHP代码行对来自SQL语句的查询响应进行urldecode.自动完成.
I managed to use a seperate line of PHP code to urldecode the query response back from the SQL statement before it was passed to the json_encode which is used for the JQuery autocomplete.
这篇关于带有URL解码的MySQL SELECT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文