Welcome to WebmasterWorld Guest from 23.20.230.24

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

formatting array?

formatting an array when select * is used

     
7:58 pm on Jun 30, 2009 (gmt 0)

5+ Year Member



This is probably an easy answer, but when I use the code below my output is all on one line like
applebananaorangemango

There are only 2 fields on this table, ID and ITEM.
I'd like it to print in this format:
apple
banana
orange
mango


$query = mysql_query("SELECT * FROM menu")
or die (mysql_error());
while ($data = mysql_fetch_array($query, MYSQL_ASSOC))
{
print_r ($data['ITEM']);
}
8:12 pm on Jun 30, 2009 (gmt 0)

10+ Year Member



instead of:

print_r ($data['ITEM']);

try

echo $data['ITEM']."<br />\r\n";

8:40 pm on Jun 30, 2009 (gmt 0)

5+ Year Member



thanks!
 

Featured Threads

Hot Threads This Week

Hot Threads This Month