Jump to content

result from mysql into foreach?


marf

Recommended Posts

when using mysql_fetch_array($result)

 

I usually toss that into a while loop like so

 

while($row = mysql_fetch_array($result)){
...
}

 

however I was wondering if there was a way to put it in a foreach statement like so

 

foreach(mysql_fetch_array($result) as $row){
...
}

 

Is that legit? Will this work?

Link to comment
https://forums.phpfreaks.com/topic/57023-result-from-mysql-into-foreach/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.