Re: mysql_fetch_object and modulo %

From: Date: Wed, 19 Nov 2008 13:53:54 +0000
Subject: Re: mysql_fetch_object and modulo %
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-283526@lists.php.net to get a copy of this message
Alain Roger wrote:
Hi, how can i do to test if the row number (record number) sent by mysql_fetch_object is odd or even ? i mean that: while ($row = mysql_fetch_object($result))
    {
     if($row%2 == 1)
     {
      ...
     }
    }
the $row doesn't return a value... like 1, 2 or 6 for example... thx. F $i = 0;
while ($row = mysql_fetch_object($result))
    {
     if(++$i%2 == 1)
     {
      ...
     }
    }


« previous php.general (#283526) next »