-3
我有这个插入的PHP代码:从MySQL返回插入和取回??????????????签署阿拉伯文字
<?PHP
require("config.inc.php");
if (!empty($_POST)) {
$query = "INSERT INTO projects (project_author, project_title, project_spec, project_links, project_desc,created_at) VALUES (:user, :title, :spec, :links, :desc, NOW()) ";
$query_params = array(
':user' => $_POST['author'],
':title' => $_POST['title'],
':spec' => $_POST['spec'],
':links' => $_POST['links'],
':desc' => $_POST['desc'],
);
try {
$stmt = $db->prepare($query);
$result = $stmt->execute($query_params);
}
catch (PDOException $ex) {
$response["success"] = 0;
$response["message"] = "Database Error. Couldn't add post!";
die(json_encode($ex));
}
$response["success"] = 1;
$response["message"] = "Post Successfully Added!";
echo json_encode($response);
}else{
echo 'omar almrsomi';
}
?>
从MySQL中检索PHP代码:
<?php
$mysql_db_hostname = "com";
$mysql_db_user = "xxxxx";
$mysql_db_password = "xxxxxxxxxx";
$mysql_db_database = "xxxxxxxxx";
$con = @mysqli_connect($mysql_db_hostname, $mysql_db_user, $mysql_db_password,
$mysql_db_database);
if (!$con) {
trigger_error('Could not connect to MySQL: ' . mysqli_connect_error());
}
$var = array();
$sql = "SELECT * FROM projects";
$result = mysqli_query($con, $sql);
while($obj = mysqli_fetch_object($result)) {
$var[] = $obj;
}
echo '{"projects":'.json_encode($var).'}';
?>
问题:
插入和检索MySQL给了?????????????标志。
注:
在阿拉伯语中插入文本。
问:
如何插入阿拉伯语(Unicode)的到MySQL?
在此先感谢
您的一些downvotes(在一个相当明确的问题,否则)可能是由于您使用全部大写(现在编辑出)。这通常与互联网上的呼喊有关。 – halfer