Question: how to export data in text file using php?
Answer: $last) fwrite($fh, ", "); } fwrite($fh, "\n"); } fclose($fh); ?> This simple PHP script will save all the data in a table to a . txt file. Records will be separated by new lines, and fields by a tab character.