What I am trying to do is pass my database to excel. This is what I have so far:
$contents = "Nombre, Dirrecion, Telefono, Categoria, Correo\n";
$query = "SELECT datos.list, datos.addr, datos.tel, datos.cat, mail.mail FROM datos RIGHT JOIN mail ON datos.id = mail.id";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){
if(!empty($row['list'])){
$contents.=$row['list'].",";
$contents.=$row['addr'].",";
$contents.=$row['tel'].",";
$contents.=$row['cat'].",";
$contents.=$row['mail']."\n";
}
}
$contents = strip_tags($contents);
Header("Content-Disposition: attachment; filename='excExport".date('d-m-Y').".csv'");
print $contents;
It prints out the contents correctly, when I try to open excExport.csv I can't seem to find this file in my computer.