Have you checked out the fputcsv function? You can simply read your database (using mysqli or PDO) and then for each row, write them to the excel file using fputcsv
. (Excel can use csv files in case you didn’t know)
Should be fairly straight forward.