Backup Your MySQL Database Contents to SQL File Using PHP

Here’s a snippet to backup MySQL database content to SQL file using PHP code. This code is very useful when you want to make a daily or hourly snapshot of your currently running database. Or maybe you want to add a backup feature on your blog CMS. backup_tables(‘localhost’,'username’,'password’,'blog’); /* backup the db OR just a table */ function backup_tables($host,$user,$pass,$name,$tables = ‘*’) { $link = mysql_connect($host,$user,$pass); mysql_select_db($name,$link); //get all of the Continue reading