Reputation: 4646
Im confused on how to fetch all of the stuff in my array... Its like a table from a SQL.. I can get one of them doing the following:
if ($result = mysqli_query($connection, "SELECT * FROM `todoTable` WHERE 1")) {
printf("Select returned %d rows.\n", mysqli_num_rows($result));
$row = mysqli_fetch_array($result);
echo $row[0];
mysqli_free_result($result);
}
But when i try to do all of it... It fails..
if ($result = mysqli_query($connection, "SELECT * FROM `todotable` WHERE 1")) {
printf("Select returned %d rows.\n", mysqli_num_rows($result));
// Fetch all
$row = mysqli_fetch_all($result,MYSQLI_ASSOC);
echo $row;
mysqli_free_result($result);
}
Please Help.. Thankyou
Upvotes: 2
Views: 94
Reputation: 77
Try using foreach to iterate through the array, I usually get what I want using that method.
$row = mysqli_fetch_all($result,MYSQLI_ASSOC);
foreach($row as $value)
echo $value;
Upvotes: 3