Re: method for mysql_data_seek in DB class

From: Date: Thu, 07 Mar 2002 16:12:34 +0000
Subject: Re: method for mysql_data_seek in DB class
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-939@lists.php.net to get a copy of this message
Ron Dyck wrote: > > > The 4th parameter of fetchInto() or the 3rd parameter of fetchRow() > > (optional in both cases) take the number of the row, that is passed > > to mysql_data_seek() for data retrieving. > > Here's the problem I'm having: > > I do this and get 3 rows > while ($Row = $Result->fetchRow()) { > 3 rows here > } > > rewind it: > $Result->fetchRow(DB_FETCHMODE_ORDERED, 0); Here is your problem, the cursor is placed in the row 0, but fetchRow() also fetchs this row, so your cursor is now in the row 1. Try this for the second loop: $i = 0; while ($row = $result->fetchRow(DB_FETCHMODE_ORDERED, $i++)) { ... } Tomas V.V.Cox

« previous php.pear.general (#939) next »