that's weird.. I thought I attached the code
anyway, I'll paste it here again... Thanks for the response!!
<?php
// Connect to the database server
$dbcnx = @mysql_connect("localhost",
"root", "");
if (!$dbcnx) {
echo( "<P>Unable to connect to the " .
"database server at this time.</P>" );
exit();
}
// Select database
if (! @mysql_select_db("adcol") ) {
echo( "<P>Unable to locate " .
"database at this time.</P>" );
exit();
}
// Request data
$result = mysql_query(
"SELECT usertype,COUNT(name) as data FROM jos_users GROUP BY usertype");
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
$num_fields = mysql_num_fields($result);
$headers = array();
$fp = fopen('php://output', 'w');
if ($fp && $result) {
header('Content-Type: text/csv');
header('Content-Disposition: attachment; filename="export.csv"');
header('Pragma: no-cache');
header('Expires: 0');
fputcsv($fp, $headers);
while ($row = mysql_fetch_assoc($result)) {
fputcsv($fp, array_values($row));
}
die;
}
?>