Passionate, stupid Newbie Question!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ThePHPApprentice
Forum Newbie
Posts: 3
Joined: Thu Apr 01, 2010 8:31 am

Passionate, stupid Newbie Question!

Post 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>";
}
}
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: Passionate, stupid Newbie Question!

Post by mikosiko »

User avatar
ThePHPApprentice
Forum Newbie
Posts: 3
Joined: Thu Apr 01, 2010 8:31 am

Re: Passionate, stupid Newbie Question!

Post 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!
Post Reply