List:General Discussion« Previous MessageNext Message »
From:Johnny Withers Date:December 19 2010 3:50pm
Subject:Re: Records not being displayed
View as plain text  
Your very first mysql_fetch_array consumes the first result.

On Dec 19, 2010 8:19 AM, "Gary" <gpaul@stripped> wrote:

I have an issue that the first record in a query is not being displayed.  It
seems that the first row in alphabetical order is not being brought to the

I have a MySQL DB that lists beers.  I have a column for 'type' of beer
(imported, domestic, craft, light). The queries:

$result = MySQL_query("SELECT * FROM beer WHERE type = 'imported' AND stock
= 'YES' ORDER by beername ");

When I run the query

if (mysql_num_rows($result) == !'0') {
   $row = mysql_fetch_array($result);

 echo '<h3>Imported Beers</h3>';
 echo '<table width="100%" border="0" cellspacing="1" cellpadding="1"
id="tableone" summary="">


 while ($row = mysql_fetch_array($result)) {

 echo '<tr ><td>' . $row['beername'].'</td>';
 echo '<td>' . $row['manu'] . '</td>';
 echo '<td>' . $row['type'] . '</td>';
 echo '<td width="40">' . $row['singles'] . '</td>';
 echo '<td width="20">' . $row['six'] . '</td>';
 echo '<td width="40">' . $row['can'] . '</td>';
 echo '<td width="20">' . $row['bottles'] . '</td>';
 echo '<td width="40">' . $row['tap'] . '</td>';
 echo '<td>' . $row['size'] . '</td>';
 echo '<td>' . $row['descrip'] . '</td>';
 echo '</table><br />';


All but the first row in alphabetical order are displayed properly.

Can anyone tell me where I am going wrong?

__________ Information from ESET Smart Security, version of virus signature
database 5715 (20101219) __________

The message was checked by ESET Smart Security.

MySQL General Mailing List
For list archives:
To unsubscribe:

Records not being displayedGary19 Dec
  • Re: Records not being displayedJohnny Withers19 Dec
  • Re: Records not being displayedGary19 Dec