我有一个问题我做了一个研究,常见的问题是缺少半冒号,但我确信我的代码没有错 请检查一下。
<?php
require 'connection.php';
$query = "select id from `account_info`";
$res = mysqli_query($connect,$query);
$result = array();
while($row = mysqli_fetch_array($res)){
array_push($result,
array('id'=>$row[0]
));
}
echo json_encode(array("result"=>$result));
mysqli_close($connect);
?>
connection.php
<?php
define('hostname','mysql.hostinger.ph');
define('user','********_mftis');
define('password','********');
define('databaseName','u366906409_mftis');
$connect = mysqli_connect(hostname,user,password,databaseName);
?>
答案 0 :(得分:0)
将您的查询写为
$query = "select * from 'account_info'";