PHP record results

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
b00ker_b0y
Forum Newbie
Posts: 10
Joined: Thu Jun 22, 2006 7:16 am

PHP record results

Post by b00ker_b0y »

Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi; does anyone know who to put commas in between record results and then a full stop instead of a comma on the last record to get the following:

record1, record2, record3, record4.

Code: Select all

while($row = mysql_fetch_array($kitchen)) 
{
    $facility	= $row[facility];
    echo $facility;
}
Any ideas and I would be grateful. Thank you :)


Pimptastic | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

$facility = array();
while($row = mysql_fetch_assoc($kitchen))
{
    $facility[] = $row['facility'];
}
echo implode(', ', $facility), '<br />';
:?
b00ker_b0y
Forum Newbie
Posts: 10
Joined: Thu Jun 22, 2006 7:16 am

Thank you

Post by b00ker_b0y »

Thank you
Post Reply