#!/usr/bin/php -c/var/www/batch/config/php_batch_sd.ini exportCSV(file_get_contents($sql), $csv.'.tmp'); /*$res=$iDb->query(file_get_contents($sql)); $nbLignes=mysql_num_rows($res); */ $fp = fopen("./csv2sql.log", 'a'); fwrite($fp, date('Y-m-d H:i:s')." - $base $sql $csv : $nbLignes lignes extraites".EOL); fclose($fp); /* $i=0; $fp = fopen($csv.'.tmp', 'w'); while ($ligne=$iDb->fetch(MYSQL_ASSOC)) { if ($i==0) { foreach ($ligne as $libCol=>$col) fwrite($fp, $libCol.','); fwrite($fp, EOL); } foreach ($ligne as $libCol=>$col) fwrite($fp, $col.','); fwrite($fp, EOL); $i++; } fclose($fp); */ move($csv.'.tmp', $csv); die(); ?>