Records not being displayed

Records not being displayed

am 19.12.2010 15:18:42 von gary

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
screen.

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 '

Imported Beers

';
echo ' id="tableone" summary="">










';

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

echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
'';
}
echo '
Beer Maker Type Singles 6-Packs Cans Bottles Draft Size Description
' . $row['beername'].'' . $row['manu'] . '' . $row['type'] . '' . $row['singles'] . '' . $row['six'] . '' . $row['can'] . '' . $row['bottles'] . '' . $row['tap'] . '' . $row['size'] . '' . $row['descrip'] . '

';

}

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

Can anyone tell me where I am going wrong?
--
Gary



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

The message was checked by ESET Smart Security.

http://www.eset.com





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Records not being displayed

am 19.12.2010 16:50:49 von Johnny Withers

--0016361e844e146e910497c55e35
Content-Type: text/plain; charset=ISO-8859-1

Your very first mysql_fetch_array consumes the first result.

On Dec 19, 2010 8:19 AM, "Gary" 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
screen.

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 '

Imported Beers

';
echo ' id="tableone" summary="">










';

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

echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
echo '';
'';
}
echo '
Beer Maker Type Singles 6-Packs Cans Bottles Draft Size Description
' . $row['beername'].'' . $row['manu'] . '' . $row['type'] . '' . $row['singles'] . '' . $row['six'] . '' . $row['can'] . '' . $row['bottles'] . '' . $row['tap'] . '' . $row['size'] . '' . $row['descrip'] . '

';

}

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

Can anyone tell me where I am going wrong?
--
Gary



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

The message was checked by ESET Smart Security.

http://www.eset.com





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=johnny@pixelated.net

--0016361e844e146e910497c55e35--

Re: Records not being displayed

am 19.12.2010 17:07:01 von gary

Johnny

Thank you for your response, and you are correct. I have used that same
code for a number of other files and dont recall having that problem
(unfortunately, my recollection abilities seem to be withering).

So I removed the following lines and all works fine....I just wish I could
recall why I had it in the first place.

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

Again, thank you for your help.

Gary


"Johnny Withers" wrote in message
news:AANLkTik3nHJqkc00iw-NV1qqPDeaJ1_5xTWbf7skdko7@mail.gmai l.com...
> Your very first mysql_fetch_array consumes the first result.
>
> On Dec 19, 2010 8:19 AM, "Gary" 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
> screen.
>
> 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 '

Imported Beers

';
> echo ' > id="tableone" summary="">
>
>
>
>
>
>
>
>
>
>
> ';
>
> while ($row = mysql_fetch_array($result)) {
>
> echo '';
> echo '';
> echo '';
> echo '';
> echo '';
> echo '';
> echo '';
> echo '';
> echo '';
> echo '';
> '';
> }
> echo '
BeerMakerTypeSingles6-PacksCansBottlesDraftSizeDescription
' . $row['beername'].'' . $row['manu'] . '' . $row['type'] . '' . $row['singles'] . '' . $row['six'] . '' . $row['can'] . '' . $row['bottles'] . '' . $row['tap'] . '' . $row['size'] . '' . $row['descrip'] . '

';
>
> }
>
> All but the first row in alphabetical order are displayed properly.
>
> Can anyone tell me where I am going wrong?
> --
> Gary
>
>
>
> __________ Information from ESET Smart Security, version of virus
> signature
> database 5715 (20101219) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=johnny@pixelated.net
>
>
>
> __________ Information from ESET Smart Security, version of virus
> signature database 5715 (20101219) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>



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

The message was checked by ESET Smart Security.

http://www.eset.com





--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org