Hi,
I guess a lot of you have been dealing with getting data from a SQL database to a spredsheet format (csv)
And in the loop you have to remove the last semi colon or whatever character you use
My technique has always been counting the total first and the do a if/else statement in the loop to see when the last row is called.
here is a technique I just found out using PHPs trim function
<?
//DATA
$foo = Array("a","b","c","d","e","f");
foreach($foo as $foobar) {
//Store the data in one string
$newfoo .= $foobar.";";
}
//Remove the last semicolon.
echo trim($newfoo,";");
?>
Anyone who has any other effective examples of this?
regards,
Thomas Andersen