Posted by David Gillen on 05/09/07 15:23
john said:
> Now that I have the $result (a multidimensional array), what is the
> PHP idiom for iterating through the set, e.g., to create an HTML table
> of the data? Should I be thinking foreach() or something else?
>
Foreach would be the way to go. It doesn't care how many results there are
unlike other looping mechanisms which makes it the superior choice imho.
Typically though when looping over results from a database
while($row = fetchRowFromDB())
{
// Process Row
}
is the way it would be done.
But given you already have all rows retrieved foreach is preferable.
D.
--
Fermat was right.
Navigation:
[Reply to this message]
|