php+mysql乱码问题

来源:百度知道 编辑:UC知道 时间:2024/06/22 01:35:05
我的网页是gb2312格式。用PHP语句写入mysql的汉字全变成了问号。但是我直接在mysql中插入记录的话就不是乱码。。。我应该怎么办??用set names "gbk/gb2312/utf8";试过这三种了。效果只是不是问号了。而变成了别的乱码。。。。。大哥们快帮帮我。 在线等!!!!

在MYSQL 数据库的安装目录下 你找到 my.ini的文件 把这快设置一下看看

default-character-set=gb2312

# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]

# The TCP/IP Port the MySQL Server will listen on
port=3306

#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL/MySQL Server 5.0/"

#Path to the database root
datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/"

# The default character set that will be used when a new schema or table is
# created and no character set is defined
default-character-set=gb2312

第一行和最后一行两个地方把 编码设置一下