【发布时间】:2014-01-29 12:42:52
【问题描述】:
我无法从 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 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);
}
?>
这是我的数据库,我已将所有排序规则设置为 utf-8 ci 格式,但仍然无法正常工作:
我已经尝试了所有可能的解决方案和在线帮助,浏览了热门帖子和答案,还设置了浏览器设置以支持印地语语言,但仍然在输出中显示 ? 标记。这是输出格式
भगवान{"id":"1","desc":"???? ??????"}
【问题讨论】: