Re: losing first row of an array

From: Date: Fri, 02 Nov 2001 22:47:33 +0000
Subject: Re: losing first row of an array
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-13961@lists.php.net to get a copy of this message
nice spot I went blind for a min.....lol is there any to write columns first but still call fields with headers? as writing in a table would not allow keeping <tr> tags open ie. echo"col[1]"; echo"col[2]"; array_flip do the job? but how? Sean Matthew Loff <matt@willetts.com> wrote in message news:005c01c163e0$5716ca20$0ce60281@bang... > > You are overwriting the first row. > > $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"); > > if(mysql_num_rows()) > while ($row = mysql_fetch_array($result) > { > echo "$row[club_id]"; > echo "$row[id]"; > echo "$row[ac_year]"; > echo "$row[ac_type]"; > } > else .....blablabla.... > > ...Or... > > $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); > > if ($row) > do { > echo "$row[club_id]"; > echo "$row[id]"; > echo "$row[ac_year]"; > echo "$row[ac_type]"; > } while($row = mysql_fetch_array($result)); > else .....blablabla.... > > > -----Original Message----- > From: Seany [mailto:php@devoy.ws] > Sent: Friday, November 02, 2001 2:09 PM > To: php-db@lists.php.net > Subject: [PHP-DB] losing first row of an array > > > 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); > > 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 > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#13961) next »