How to backup the mysql database and download it as a .sql file by using PHP Codes
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A very simple solution would be something like (first example):
http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/using-php-to-backup-mysql-databases.aspx
Naturally this will only make a Data dump of the table.
What you could do is use this code:
http://snipplr.com/view/173/mysql-dump/
What this code does is actually gets a description of the table (i.e its structure), creates all the tables and pushes data. pretty much like any other tool does.
Then its just a matter of saving it from string to a file (file_put_contents() for instance or something similar, depending on your preference and need)