Export table in hooks as csv
Posted: 2021-10-27 15:58
Hello board, I use the following to export a table to a csv. This csv is then used as the drop downs in another page.
This has worked ok for years but in the last week one of the teams has a comma in it. This has now altered the way the csv is output. Rather than everything being in cell A1, everything is split between A1 & A2 (where the comma is it splits the data).
My hope is somebody can help me fix this so that everything is output into the one cell again (A1)
Code: Select all
function update_Teams_list() {
// Update Teams
$Teams = array();
$res = sql("select Teams from Teams order by Teams", $eo);
while($row = db_fetch_assoc($res))
$Teams[] = $row['Teams'];
// save the Teams to the options list file
$list_file = dirname(__FILE__) . '/Leagues.TeamsList.csv';
@file_put_contents($list_file, implode(';;', $Teams));
}
My hope is somebody can help me fix this so that everything is output into the one cell again (A1)