Question: how to export mysql data to excel sheet 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 (!