Jump to content

formatting


unknown1

Recommended Posts

Hello all, I have a script that adds multiple items to a single row in a database table and

when I echo it out I get item1, item2, item3,,,,,,,,item14,,,,,item 20

 

each item represents a radio that was posted to the database in an array.... so the output is comma separated and this is fine but when some of the values are blank it has just the comma e.g. ,,,,,,,,,, is blank posts.

Does anyone know of a way I can format this so the output is only one comma after value and if value is empty the extra commas are removed.

 

I have tried str_replace but in that case it replaces all and not just the one NOT needed.

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/185180-formatting/
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.