problems with WHILE LOOPS!!!!
Posted: Mon Apr 21, 2003 4:58 pm
I just switched to a new host service and now evey time i run a while loop i get error message. This is my while loop:
$count = 0;
$result = mysql_query("SELECT mid FROM members WHERE logged_on='1'")
or die ("cannot select horse name");
$mid = mysql_result($result,$count,"mid");
while ($mid != "") //member id
{
$result = mysql_query("SELECT name FROM members WHERE mid='$mid'")
or die ("cannot select horse name");
$name = mysql_result($result,0,"name");
//link to that member's page goes here
$result = mysql_query("SELECT mid FROM members WHERE logged_on='1'")
or die ("cannot select horse name");
$mid = mysql_result($result,$count,"mid");
$count++;
}
But when i run this script i get the following warning:
Warning: Unable to jump to row 3 on MySQL result index 12 in /home/whiteoak/public_html/english/updates.php on line 252
Line 252 is the one I've highlighted in red. Can anyone help me? I've tried changing my loop and still no success...
Jade
$count = 0;
$result = mysql_query("SELECT mid FROM members WHERE logged_on='1'")
or die ("cannot select horse name");
$mid = mysql_result($result,$count,"mid");
while ($mid != "") //member id
{
$result = mysql_query("SELECT name FROM members WHERE mid='$mid'")
or die ("cannot select horse name");
$name = mysql_result($result,0,"name");
//link to that member's page goes here
$result = mysql_query("SELECT mid FROM members WHERE logged_on='1'")
or die ("cannot select horse name");
$mid = mysql_result($result,$count,"mid");
$count++;
}
But when i run this script i get the following warning:
Warning: Unable to jump to row 3 on MySQL result index 12 in /home/whiteoak/public_html/english/updates.php on line 252
Line 252 is the one I've highlighted in red. Can anyone help me? I've tried changing my loop and still no success...
Jade