Use the function mysql_data_seek(result variable, row number)
so in your case it would be: mysql_data_seek($result2, 0);
You should also consider suppressing the warning for an empty set by placing
a '@' in front of the function

----- Original Message -----
From: "Ivan Carey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 15, 2001 7:32 AM
Subject: [PHP] how to reinitialise an MySQL_fetch_array


Hello,
I would like to reinitialise an MySQL_fetch_array. That is, once it has gone
through I would like to be able to go back to the start again.

for eg
while ($myrow=MySQL_fetch_array($result2))
    {
     $befid=$myrow["beforeid"];

     while($myrow5=MySQL_fetch_array($result5))
         {
              $aftid=$myrow["afteridid"];
              if ( $befid == aftid)
                  {
                      do something;
                  }
         } //while($myrow5=MySQL_fetch_array($result5))

        //now that the inner loop has finished I would like to be able to
restart the inner loop by reinitailsing the MySQL_fetch_array

    } //while ($myrow=MySQL_fetch_array($result2))

Regards,
Ivan





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to