Jump to content

echoing associative array as csv; how to omit last comma


rubing

Recommended Posts

hey friends,

 

I am using php to display all results from my table as a comma seperated string.  However I don't want the comma after the last result.  Should I just use string substition to eliminate the last character?

 

while ((($row = $result->fetch_assoc()) !== NULL) && ($i < $limit)) 

			{
				$clip=$row['mp3id'];
				$clip ="http://www.example.com/musicserve.php?id=".$clip;
				echo $clip . ",";
				++$i;
			}

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.