Welcome Guest, Not a member yet? Register   Sign In
Database Utility Class - csv_from_result
#1

[eluser]mikepuerto[/eluser]
Any suggestions on how to prevent this from adding the delimiter to the last field on a line?

Example, the output is:

field1,field2,field3,field4,

need to get rid of the last comma on the line.

Thanks!
#2

[eluser]brianw1975[/eluser]
lol it's stupid simple, i struggled with it for a long time too and found it mindbogbling infuriating how easy it actually is, it's so easy I had to look it up! lol

// remove the trailing commas
$str = substr($str,0,-1);
#3

[eluser]mikepuerto[/eluser]
Awesome! Thnx!




Theme © iAndrew 2016 - Forum software by © MyBB