Jump to content

I'VE GOT A GOOD CHALLENGE FOR YOU PHP GRAND MASTERS!!!


Freedom-n-Democrazy

Recommended Posts

LOL note the topic is a pun at Help Vampires... I actually have an unchallenging question.

 

I'm trying to echo out a column in a MySQL table. I'm getting one field echoing, but not the others:

I'm using this code style, but I've made a small mistake somewhere at the end, I've tried many combinations trying to fix it, but haven't succeeded..

$query = "select email from newsletters"; $result = mysql_query($query); $row = mysql_fetch_array($result); foreach ($row as $email) {echo $email;}

I got the argument foreach() straight out of the manual and copied the syntax style exactly as was demonstrated in the example, but its still not working. What have I done wrong?

The fetch function, and the the foreach() loop need to be within a while loop. The foreach loop will only iterate over the array of the one returned record.

 

This thread is be solved, but I would like to know what "iterate over the array" means in English. Can someone please explain?

I ask because although I can see how the solution worked for my issue, 'iterating' may apply to future PHP functions, and I don't know when the word should be used.. so hopefully in street- talk will help me understand better. ;)

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.