Location: PHPKode > scripts > ER Manager > ermanager/export.php
<?PHP

$csvfilename = "companies";
//$csvfilename = "indirizzi_aziende";

require_once "config.inc.php";
require_once "functions.php";

$export = "SELECT * FROM er_companies";
$resQuery = dbquery($export);

header("Content-Type: application/csv-tab-delimited-table");
header("Content-disposition: filename=$csvfilename.csv");

if (mysql_num_rows($resQuery) != 0) {
  // titre des colonnes
  $fields = mysql_num_fields($resQuery);
  $i = 0;
  while ($i < $fields) {
    echo "\"".mysql_field_name($resQuery, $i)."\"".";";
    $i++;
  }
  echo "\n";

  // données de la table
  while ($arrSelect = mysql_fetch_array($resQuery, MYSQL_ASSOC)) {
   foreach($arrSelect as $elem) {
    echo "\""."$elem"."\"".";";
   }
   echo "\n";
  }
}
?>
Return current item: ER Manager