1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| $row = mysql_fetch_assoc($DBexport);
if(!$row){ jsalert( "le fichier Mysql ne peut pas être lu ou est vide"); return false; }
for($i=0;$i< mysql_num_fields($DBexport);$i++)
if(mysql_field_type($DBexport,$i)== 'int'|mysql_field_type($DBexport,$i)== 'float'|mysql_field_type($DBexport,$i)== 'tinyint'|
mysql_field_type($DBexport,$i)== 'decimal')
$row[$i]= numberformat($row[$i],2,',','');
fputcsv($handle, array_keys($row), ';'); // liste des titres de colonne
do
{
fputcsv($handle, $row, ';'); // on commence à remplir le tableau
}
while($row = mysql_fetch_assoc($DBexport));
fputcsv($handle, $row, ';'); // on fini le remplissage du tableau |
Partager