Daniel, the title must be long before someone will come to see!
Source: Internet
Author: User
Daniel says the title must be long before anyone can see!!!!!!!!!!!!!!!.
All right, I'm a newbie!
Today in the database when the Chinese always appear garbled! According to the Internet, the database, data tables, fields are unified coding utf-8, and the Web page also set the Charset=utf-8, and the browser display other Chinese is no problem, is the database to take out the things displayed are? Finally, I added @mysql_query ("SET NAMES ' UTF8 '") to solve it!
The problem comes!!!
Do you want to add this sentence to every database operation? Is there any other better way that can be painless permanently?
Oh yes, I'm using phpMyAdmin and MySQL ...
Consult the Daniel!!!
------Solution--------------------
Of course it can, as long as you install MySQL, choose the code you need to
Since it's a database, of course it's for everyone.
But the needs of others must be the same as you?
------Solution--------------------
Do not add each time, as long as the Choice mysql_select_db () after the sentence can be
------Solution--------------------
discuss
Do not add each time, as long as the Choice mysql_select_db () after the sentence can be
------Solution--------------------
Modify the My.ini file
Add in [client]:
Default-character-set=utf8
------Solution--------------------
Modify the database configuration file My.ini
------Solution--------------------
Write a connection class that calls only the method at a time:
http://topic.csdn.net/u/20120415/21/d385678f-cbd1-4b83-b3de-5effe73db8ee.html?18960
------Solution--------------------
Yes, PHP notifies MySQL every time it connects to MySQL, and what coding interaction you want to use.
Do not need to be notified repeatedly before each mysql_query, after each connection to MySQL.
------Solution--------------------
In the project are all write DB class, only need to call the method, pass parameters on the line. No need to write mysql_query yourself ("SET NAMES ' UTF8 '");
------Solution--------------------
Write a class MySQL category, set the code in the class,
Instantiating MySQL classes every time the library is in position.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.