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
That's because $row is an object. Return your row uid (unique
identifier; primary key w/ auto increment) and do:
while ( $row = mysql_fetch_object($result) )
{
if( $row->UID % 2 == 1 )
{
...
}
}
replacing UID with whatever you called the field in the database.
Hope this helps,
- Craige
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php