How can use foreach to Loop Through PHP Array
Posted
by jtom
on Stack Overflow
See other posts from Stack Overflow
or by jtom
Published on 2010-06-12T06:16:31Z
Indexed on
2010/06/12
6:22 UTC
Read the original article
Hit count: 174
php
How can use foreach loop to loop through the $Result?
$Query = mysql_query("SELECT * FROM mytable"); $Result = array( );
while ($Row = mysql_fetch_array ( $Query) ) {
$Result [ ] = $Row;
}
mysql_free_result($Query);
print_r ($Result);
?>
I just have very vague idea:
foreach ($Result ) { echo $row[fname] . ' ' . $row[lname] . ' ' $row[email]; }
?>
Could someone help please?
© Stack Overflow or respective owner