Is there any method to use foreach instead of while with mysqli_fetch_object($query)?
For example:
while($row = mysqli_fetch_object($query)) {
echo $row->title;
}
How to use it with Foreach?
IF you have PHP 5.4 you could do this:
// Using iterators (support was added with PHP 5.4)
foreach ( $c->query('SELECT user,host FROM mysql.user') as $row ) {
printf("'%s'@'%s'\n", $row['user'], $row['host']);
}
LIke this you use the iterator to loop through every result set and then you can use it as $row
a