Question: how to export data from mysql to excel in php?
Answer: xls"; // File Name // Download file header("Content-Disposition: attachment; filename=\"$filename\""); header("Content-Type: application/vnd. ms-excel"); $user_query = mysql_query('select name,work from info'); // Write data to file $flag = false; while ($row = mysql_fetch_assoc($user_query)) { if (!