I'm trying to create an array of all the data in a table.
So far I am querying the database, and then iterating through the array to add each row to it.
But I'm getting an error I haven't seen before and cannot work out what it means:
Fatal error: An iterator cannot be used with foreach
Here is the code. I want to be grabbing the whole table, row by row, and appending it onto my $data array so I have an array of complete data from the table.
$result = mysqli_query($con, "SELECT * from everystory_Comp");
foreach ($result as &$row){
$row = mysqli_fetch_assoc($result);
var_dump($row);
array_push($data,$row);
}