Monday, October 25, 2010

Home Grown : 9. Database backup with php

Why would we need a Mysql Backup tool using PHP?

Well there may be many reasons, when you don't have access to the Database through cpanel/the hosting provider's phpmyadmin panel (Usually admins have them, so they might not give you the full access to the hosting account). All you're concerned is with data in the database. So you can use this php code to backup the database as a SQL file. This is very handy when you want to manually sync the online database with your local database.
In out Tutorial project you have this as Page 7. The code is really simple. We make a connection to the database in question. Then we get table structure and later we fetch the data in tables and add it to querystrings to be added to the sql file.

Download the Project from

No comments:

Post a Comment