Thanks, works like a charm (had to make is -2 instead of -1 as it added a space after each result). Hadn't thought of something so simple. Regards, Alex. On 24/3/06 16:22, "Bastien Koert" <bastien_k@xxxxxxxxxxx> wrote: > Build it up as a string and remove the trailing comma at the end of the loop > > do { $sHTML .= ''.$administrators['username'].', ';} > while ($administrators = mysql_fetch_assoc($administrators_result)) > > $sHTML = substr($sHTML, 0, strlen($sHTML)-1); > > echo $sHTML; > > ?> > > Bastien > > > >> From: Alex Major <alex.major@xxxxxxxxxxxx> >> To: <php-db@xxxxxxxxxxxxx> >> Subject: Displaying results from a query properly. >> Date: Fri, 24 Mar 2006 16:19:10 +0000 >> >> Hi there. >> This isn't a major problem, more of a matter of aesthetics. >> Basically, I have a query which pulls a list of usernames from the database >> (based on their user level). >> >> These users should then listed in this fashion. >> >> Administrators: allydm, alex, mike, dave >> Moderators: big 'd', frank, william >> >> However, the loop that I have returns the results like this... >> >> Administrators: allydm, alex, mike, dave, >> Moderators: big 'd', frank, william, >> >> There is a , after each username, including the last one in that list. I'm >> after a way of making the usernames display with a , after them, apart from >> the last username in that set of results. >> >> My current display code is: >> >> <?php >> do {echo ''.$administrators['username'].', ';} >> while ($administrators = mysql_fetch_assoc($administrators_result)) >> ?> >> >> How could I change to display the results in the fashion that I'd like? >> Many thanks for any suggestions. >> >> -- >> PHP Database Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php