php var_dump returning blank array

Posted by Oroku on Stack Overflow See other posts from Stack Overflow or by Oroku
Published on 2014-08-19T21:58:08Z Indexed on 2014/08/19 22:20 UTC
Read the original article Hit count: 131

Filed under:
|

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);
?>

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays