我在我的表上执行这个select语句
$get_ads_by_category_query = "select name from sorvy_djcf_items where cat_id='38'";
if(mysqli_select_db($conn,'joyshopp_adds')){
$result = mysqli_query($conn, $get_ads_by_category_query);
if( mysqli_num_rows($result) > 0 ){
$row = mysqli_fetch_row($result;
echo $row[0];
}
当我执行此查询时,返回格式错误的JSON:Unexpected'?'在浏览器中你知道为什么会这样吗???
你有解决方案吗?
我也看到了这个How to convert an entire MySQL database characterset and collation to UTF-8?并尝试将数据库排序规则更改为utf8,但它没有用...
答案 0 :(得分:0)
使用json_encode
返回JSON响应。
echo json_encode($row[0]);