1
I am trying to get information from php database and pass to JSON, however it always comes empty returns null and without any error.
[
{
"current_field": null,
"field_count": null,
"lengths": null,
"num_rows": null,
"type": null
}
]
Below the PHP code:
<?php
require 'conexao.php';
$temperatura = "SELECT * FROM estufas";
$resultado_temperatura = mysqli_query($conexao,$temperatura)or
die(mysqli_error($conexao));
if (mysqli_num_rows($resultado_temperatura) > 0) {
$dados[] = $resultado_temperatura;
echo json_encode($dados, JSON_PRETTY_PRINT);
}
?>