Php 无法获取正确格式的数据
我无法从MySQL解析PHP中的数据 这是我的密码Php 无法获取正确格式的数据,php,mysql,utf-8,Php,Mysql,Utf 8,我无法从MySQL解析PHP中的数据 这是我的密码 <?php header('Content-Type: text/html; charset=utf-8'); // array for JSON response $response = array(); echo 'भगवान'; require_once __DIR__ . '/db_connect.php'; // connecting to
<?php
header('Content-Type: text/html; charset=utf-8');
// array for JSON response
$response = array();
echo 'भगवान';
require_once __DIR__ . '/db_connect.php';
// connecting to db
$db = new DB_CONNECT();
// get all products from products table
$result = mysql_query("SELECT *FROM create_event") or die(mysql_error());
// check for empty result
if (mysql_num_rows($result) > 0) {
// looping through all results
// products node
$response["create_event"] = array();
while ($row = mysql_fetch_array($result)) {
// temp user array
$product = array();
$product["id"] = $row["id"];
$product["desc"] = $row["desc"];
$text;
array_push($response["create_event"], $product);
}
// success
$response["success"] = 1;
echo json_encode($response);
} else {
// no products found
$response["success"] = 0;
$response["message"] = "No products found";
// echo no users JSON
echo json_encode($response);
}
?>
在连接到数据库后或使用任何select语句之前使用此选项
भगवान{"id":"1","desc":"???? ??????"}
mysql_query('SET character_set_results=utf8');