Jump to content

[SOLVED] probably simple


timmah1

Recommended Posts

I have a query that pulls some information out of the database

<?php
$q1 = mysql_query("SELECT * FROM subCat WHERE mainID = '$id' ORDER BY name LIMIT 5"); 
					while ($b1 = mysql_fetch_array($q1)) {  

					echo "<span class='page_content1'><a href='business.php?id=$b1[id]&main$main'>$b1[name]</a></span>";
?>

 

It works with no problem, but how would I take the 5 results and seperate them with a comma, with the last one not have a comma?

 

Right now it's like this

text1 texxt2 text3 text4 text5

 

But how do I get it to look like this

text1, texxt2, text3, text4, text5

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/143878-solved-probably-simple/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.