0
您好IAM真正的戰鬥來解決這個問題將Unicode字符數據庫問題
我有一個腳本,將阿拉伯字母到數據庫
我的數據庫和表是utf-unicode_ci
$title = make_safe($_POST['title']);
$author = make_safe($_POST['author']);
$category = make_safe($_POST['category']);
$meta = str_replace(array('-', ' ', '*'),",",make_safe($_POST['meta']));
if ($title == "" OR $author == "" OR $category == "")
{
echo $lang['STORY_FIELDS_MUST_FILL'];
echo "<META HTTP-EQUIV='refresh' CONTENT='2; URL= stories.php?action=add'>";
}
else
{
$stmt = $db->prepare ("INSERT INTO stories (title,author,category,meta,date)
VALUES (:title,:author,:category,:meta)");
$stmt->execute(array(':title' => $title,
':author' => $author,
':category' => $category,
':meta' => $meta));
echo "$lang[STORY_ADDED]";
echo "<META HTTP-EQUIV='refresh' CONTENT='2; URL=" . $_SERVER['HTTP_REFERER'] . "'>";
}
當添加文章從這個PHP代碼它顯示在這樣的phpmyadmin
當我插入值,通過phpMyAdmin的
它表明這樣的,一切要細
如何通過PHP代碼添加它來顯示同樣喜歡從phpMyAdmin的將它添加
所以'make_safe'必須有一些技巧在做。如果您也可以發佈該功能。 – Rikesh 2013-04-22 09:10:24
當你連接到mysql時,你執行'SET names utf8'查詢嗎? – krcko 2013-04-22 09:11:10
'make_safe()'似乎是不必要的 – 2013-04-22 09:11:41