Jump to content

Echoing multiple rows from a MySQL database


Freedom-n-Democrazy

Recommended Posts

I'm trying to echo multiple rows from a MySQL database with no luck.

 

I've tried this code and many other combinations with it, but can't seem to get a result.

$query = "select email,mens,womens from newsletters"; $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) {foreach ($row as .$email. .$mens. .$womens.) {echo "$email - $mens - $womens<BR>";}}

 

What am I doing wrong?

I've tried:

 

foreach ($row as $email $mens $womens)

foreach ($row as ['$email'] ['$mens'] ['$womens'])

foreach ($row as .$email. .$mens. .$womens.)

foreach ($row as ".$email." ".$mens." ".$womens.")

foreach ($row as $email . $mens . $womens)

foreach ($row as $email . $row as $mens . $row as $womens)

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.