Page 1 of 1

Passionate, stupid Newbie Question!

Posted: Thu Apr 01, 2010 8:39 am
by ThePHPApprentice
Hi Guys!

I just registered to this wonderful site. I have been learning PHP for the past few weeks. I can nn longer rely on my wits alone if I am going to be progressing at a steady rate. I NEED YOU GUYS once in a while... like now.

Can someone tell me why I my first while loop echoes something to me but not the second one? Is it a variable issue, or a loop issue? Roadblock. Please don't call be an idiot...

Cheers

Here's the code:

// Use returned data

// team buttons
$counter = 0;
while($row = mysql_fetch_array($result)) {
$counter = $counter + 1;
if ($counter < 8) {
echo "<a href=\"\">" . $row['team_name'] . "</a>" . " | ";
} else {
echo "<a href=\"\">" . $row['team_name'] . "</a>";
}

}
echo "<br />";
echo "<br />";

$counter = 0;
while($row = mysql_fetch_array($result)) {
$counter = $counter + 1;
if ($counter < 8) {
echo "<a href=\"\">" . $row['rank'] . "</a>" . " | ";
} else {
echo "<a href=\"\">" . $row['rank'] . "</a>";
}
}

Re: Passionate, stupid Newbie Question!

Posted: Thu Apr 01, 2010 9:25 am
by mikosiko

Re: Passionate, stupid Newbie Question!

Posted: Thu Apr 01, 2010 10:33 am
by ThePHPApprentice
Ok, I understand. My internal pointer was not reset which is what mysql_data_seek does. That is why I was not getting any result with my second loop. Thanks a bunch! Quick reply! Awsome forum!