$item is probably undefined, unless you are assigning it a value somewhere
else in your script.  mysql_fetch_array is putting the result set in an
associative array called $line, so $line['item'] would hold the result from
your query.


-----Original Message-----
From: Beauford.2003 [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 03, 2002 5:39 AM
To: [EMAIL PROTECTED]
Subject: Select, mysql_fetch_array, PHP question


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
<[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

Reply via email to