Simple MySQL Export Function


A simple PHP function to get the contents of a MySQL database (uses MySQLi) as SQL (which can be saved as a .SQL file).
This is a simple PHP function that will return the contents of a MySQL database, complete with structure and content of all tables. You can implement this function however you please; whether to save the output as a file, to copy one database to another or to do something different (see examples for programmed examples). This function can be run in just 2 lines of code, one to include the function and one to run it. This does not require mysqldump and does not require administrator or sudo access. The output provided can be used to recreate and restore the entire database, from the structure to the content of every single individual table.

This script comes with documentation that includes coded examples on how this function can be used (see the demo for more info), the code for the function is fully annotated.


WhatsApp Chat via Whatsapp
%d bloggers like this: