mirror of
https://github.com/jcreek/Assassins-Mission-Control.git
synced 2026-07-13 02:53:44 +00:00
Further admin tools
There’s a bug where the CSV export isn’t putting anything into the CSV
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
// Download the file
|
||||
|
||||
$filename = "myFile.csv";
|
||||
header('Content-type: application/csv');
|
||||
header('Content-Disposition: attachment; filename='.$filename);
|
||||
|
||||
// Fetch Record from Database
|
||||
|
||||
$output = "";
|
||||
$table = "usersfinal";
|
||||
$sql = mysql_query("select * from $table");
|
||||
$columns_total = mysql_num_fields($sql);
|
||||
|
||||
// Get The Field Name
|
||||
|
||||
for ($i = 0; $i < $columns_total; $i++) {
|
||||
$heading = mysql_field_name($sql, $i);
|
||||
$output .= '"'.$heading.'",';
|
||||
}
|
||||
$output .="\n";
|
||||
|
||||
// Get Records from the table
|
||||
|
||||
while ($row = mysql_fetch_array($sql)) {
|
||||
for ($i = 0; $i < $columns_total; $i++) {
|
||||
$output .='"'.$row["$i"].'",';
|
||||
}
|
||||
$output .="\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
print $output;
|
||||
exit;
|
||||
?>
|
||||
Reference in New Issue
Block a user