Re: losing first row of an array

From: Date: Mon, 05 Nov 2001 14:52:57 +0000
Subject: Re: losing first row of an array
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-14014@lists.php.net to get a copy of this message
Hi Seany, On Fri, 2 Nov 2001 19:09:19 -0000, php@devoy.ws (Seany) wrote: >having this code running PHP4.0b2 > >$result = mysql_query("SELECT clubac.id AS clubacid, clubac.club_id, >clubac.ac_year, clubac.ac_type, club.id >FROM clubac, club WHERE club.id = '$club_id' AND clubac.club_id = club.id"); > >$row = mysql_fetch_array($result); > You don't need to above line. This fetches the first row, then the one in the if statement (see below) fetches the second row. >if ($row = mysql_fetch_array($result)) { > >do { >echo "$row[club_id]"; >echo "$row[id]"; >echo "$row[ac_year]"; >echo "$row[ac_type]"; > >} while($row = mysql_fetch_array($result)); > >} else .....blablabla.... > >is there a fundamental miss on my part why the is printing the first or not >even recognising it >if call direct in mysql with the above query it's fine with the results even >if there is 1 row > >duh??? > >Seany > Regards, James Chin

« previous php.db (#14014) next »