


当我在手机上运行时,它无法获取我数据库中的数据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);发布于 2018-07-20 17:56:58
你已经写了newsFeedDataList != null,而不是你应该写的
if (newsFeedDataList == null){
return ;
}https://stackoverflow.com/questions/51439868
复制相似问题