PHP reads the database and sorts according to Chinese names implementation code_PHP tutorial

WBOY
Release: 2016-07-21 15:13:20
Original
1058 people have browsed it

Sometimes when we read the database output, we may need to sort according to the Chinese user name. The traditional MySQL query code is as follows:

Copy code The code is as follows:

$sql="SELECT * FROM users";//Traditional query method

The MySQL query code for sorting by Chinese user names is as follows:
Copy code The code is as follows:

$sql="SELECT * FROM users ORDER BY CONVERT(name USING gbk)";//Use according to Chinese

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326512.htmlTechArticleSometimes when we read the database output, we may need to sort it according to the Chinese user name. Traditional MySQL The query code is as follows: The copy code is as follows: $sql="SELECT...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!