我想在我的數(shù)據(jù)庫中添加漢字。我加了這個(gè)黔西南布依族苗族自治州,對這個(gè)有幫助嗎?header('Content-Type: text/html; charset=utf-16');header('Content-Type: text/html; charset=utf-8'); if(isset($_POST['totalprice'])){ $totalprice=$_POST['totalprice']; $price=$_POST['price']; $qty=$_POST['count']; $color=$_POST['color']; $name=$_POST['name']; $phone=$_POST['phone']; $address=$_POST['address']; $province=$_POST['province']; $city=$_POST['city']; $region=$_POST['region']; $payment=$_POST['payment']; $message=$_POST['message']; $model=$_POST['model']; $commodity=$_POST['commodity']; $totalprice=$_POST['totalprice']; $name=$_POST['name']; $description=''; $sql="INSERT INTO `orderItems`( `commodity`, `model`, `color`, `qty`, `total`) VALUES ('$commodity','".$model."','".$color."','".$qty."','".$totalprice."')"; $db->query($sql);}
2 回答

守候你守候我
TA貢獻(xiàn)1802條經(jīng)驗(yàn) 獲得超10個(gè)贊
插入表格時(shí)請使用utf8mb4
set username utf8mb4; INSERT INTO table_name (aaa,VAL);
您可以通過從 phpmyadmin 更改表字段并將類型設(shè)置為utf8mb4來 完成。
mysqli_query("SET character_set_results=utf8mb4", $db);
有時(shí)MySQL的utf8不支持。這是因?yàn)橛猩倭繚h字需要4字節(jié)的UTF8字符,所以 使用utf8mb4。
- 2 回答
- 0 關(guān)注
- 260 瀏覽
添加回答
舉報(bào)
0/150
提交
取消