I'm trying to get my raspberry working like a webserver.
It all works, except the queries of my mysql database. The values are correct, the query is correct and my database works fine.
But when I want to get information from my database with PHP it gives an empty result.
The code:
<?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!";
?>
the result:
this is de first row of the array: . Thats nice!
Even when I use the query in phpmyadmin, it gives the values back, so the Query isn't wrong.
So how can I solve this issue?
Edit:
The error that I get is.
Fatal error: Call to undefined method mysqli_stmt::get_result() in /var/www/html/Stramit/index.php on line 59