This code used to work on another server I used to have which I believe was running php5.# I am not on a new server running PHP Version 7.0.15-0ubuntu0.16.04.4.
Here is my code
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while($obj = mysqli_fetch_object($result)) {
$var[] = $obj;
}
}
echo json_encode($var);
echo json_encode($var[3]);
I included that second echo statement because that one works. I can get an encoding of any 1 object. However, the first echo return absolutely nothing. I have looked up this similar question all over Stackoverflow and this code seems to be the code that is in the answers. I done understand what is going wrong. Any pushing in the right direction would be greatly appreciated.