Alex, That's it - I have a if (mysql_fetch_row($result)) before the while loop. I've changed it slightly and now it works fine. The little things are always the ones that get you.
Thanks ----- Original Message ----- From: "Alex Pukinskis" <[EMAIL PROTECTED]> To: "Beauford.2003" <[EMAIL PROTECTED]> Sent: Tuesday, December 03, 2002 7:41 PM Subject: Re: Select, mysql_fetch_array, PHP question > Maybe you have an "if ($line = mysql_fetch_array($result))" line > somewhere up above? That would cause the while loop to skip the first > record... I usually use a do...while loop with recordsets to avoid this > problem. > > That's my best guess, without seeing more code. > > -Alex > > On Tuesday, December 3, 2002, at 01:40 PM, Beauford.2003 wrote: > > > That is what I have, a simple typo on my part. > > > > ----- Original Message ----- > > From: "Alex Pukinskis" <[EMAIL PROTECTED]> > > To: "Beauford.2003" <[EMAIL PROTECTED]> > > Sent: Tuesday, December 03, 2002 5:04 PM > > Subject: Re: Select, mysql_fetch_array, PHP question > > > > > >> To be honest, I'm not sure why what you're doing works at all. You > >> don't ever assign a value to the variable $item. Try changing > >> > >> echo $item; > >> > >> to > >> > >> echo $line['item']; > >> > >> Is there more code involved that you didn't include? > >> > >> -Alex > >> > >> On Tuesday, December 3, 2002, at 06:38 AM, Beauford.2003 wrote: > >> > >>> Hi, > >>> > >>> I'm trying to do a search on database through a web interface using > >>> PHP > >>> and > >>> having one small problem. Example: If I search for items that cost > >>> $5.00 and > >>> there are three of them, the query works and displays the information, > >>> but > >>> if there is only one item the query works but doesn't display the > >>> item. I > >>> just get a blank page. > >>> > >>> SELECT price, item FROM list WHERE price="$5.00"; > >>> > >>> while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { > >>> > >>> echo $item; } > >>> > >>> If I do the same search from the MySQL command line the query will > >>> display > >>> one or more items. > >>> > >>> Ideas? > >>> > >>> TIA > >>> > >>> > >>> > >>> --------------------------------------------------------------------- > >>> Before posting, please check: > >>> http://www.mysql.com/manual.php (the manual) > >>> http://lists.mysql.com/ (the list archive) > >>> > >>> To request this thread, e-mail <[EMAIL PROTECTED]> > >>> To unsubscribe, e-mail <mysql-unsubscribe- > >>> [EMAIL PROTECTED]> > >>> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > >>> > >>> > >> > >> > > > > > > > > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php