我试图让我的树莓像网络服务器一样工作。查询不适用于我的树莓派2B
这一切工作,除了我的mysql数据库的查询。值是正确的,查询是正确的,我的数据库工作正常。
但是,当我想从PHP数据库中获取信息时,它会给出一个空的结果。
代码:
<?php
$dbCon = new mysqli($servername, $username, $password, $database);
$Query = "SELECT * FROM `machineuptime`";
if($stmt = $dbCon->prepare($Query))
{
$stmt->execute();
$result = $stmt->get_result();
while($row = $result->fetch_assoc())
{
$ArrayData2[] = $row;
}
}
echo "this is de first row of the array: " . $ArrayData2[0]['ID'] . ". Thats nice!";
?>
结果:
this is de first row of the array: . Thats nice!
即使当我使用查询在phpMyAdmin,它给人的值返回,所以查询是没有错的。
那么我该如何解决这个问题呢?
编辑:
,我得到的是错误。
Fatal error: Call to undefined method mysqli_stmt::get_result() in /var/www/html/Stramit/index.php on line 59
即使我不,这个代码工作在我的笔记本... – Bart88
尝试启用错误报告补充一点:'的error_reporting(E_ALL); ini_set('display_errors',-1);'到php部分的顶部 – BRoebie
您没有结束您的查询与“ - 是一个错字,或者实际上在源?” –