我找遍了整个网络,试图找到一个关于通过 HTML 和 PHP 将阿拉伯字母插入 mysql 的教程
我的 HTML 页面是这样的
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
我的php页面是这样的
// Connects to your Database
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("castt") or die(mysql_error());
mysql_query("SET NAMES 'cp1256'");
mysql_query('SET CHARACTER SET cp1256');
当我浏览 mysql 数据库时,它显示为“??????”
有什么建议吗?
最佳答案
当您将输出声明为 UTF-8 时,您正在使数据库使用 cp1256
。那行不通。
用 UTF8
替换 cp1256
可能已经有所帮助。
关于php - 如何在mysql中插入阿拉伯字母,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7386318/