当我在手机上运行时,它无法在数据库sql中获取数据“无法获取菜单!请重试。”
这是我的php代码:
<?php
require_once "../include/Constants.php";
$conn = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$stmt = $conn->prepare("SELECT id, name, description FROM newsfeed");
$stmt->execute();
$stmt->bind_result($id, $name, $description);
$newsfeed = array();
//traversing through all the result
while($stmt->fetch()){
$temp = array();
$temp['id'] = $id;
$temp['name'] = $name;
$temp['description'] = $description;
array_push($newsfeed, $temp);
}
//displaying the result in json format
echo json_encode($newsfeed);
答案 0 :(得分:0)
您写的是newsFeedDataList != null
,而不是您写的
if (newsFeedDataList == null){
return ;
}