php var_dump returning blank array
- by Oroku
I'm following this tutorial on youtube:
https://www.youtube.com/watch?v=VSF5p00uorc
Around 4:28 - I get the following array when I load the sql.php page as in the tutorial:
array(8) { [1]=> NULL [2]=> NULL [3]=> NULL [4]=> NULL [5]=> NULL [6]=> NULL [7]=> NULL [8]=> NULL }
I do have 8 ids all with values in my data table. This is my code:
<?php
$con = mysqli_connect("localhost","root","","test2") or die('error');
$query = "select * from data";
$result = mysqli_query($con,$query);
while($row = mysqli_fetch_array($result))
{
$id = $row['id'];
$feed = $row['feed'];
$data[$id] = $feed;
}
var_dump($data);
?>