Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to export and import mysql database with its data using php script?

Tags:

php

mysql

I was asked to create an export and import mysql database with it's structure and data into a .sql file using php scripting and not phpmyadmin to make the user be able to backup his data?

Does anybody have an idea how to do that??

Thanks in advance

like image 786
Mohamed Hassan Avatar asked Apr 04 '12 22:04

Mohamed Hassan


1 Answers

SAFE and WORKING SOLUTION :

EXPORT_TABLES("localhost","user","pass","db_name"); 
// has 5th and 6th optional parameters too.

Latest version is available at github: Export.php + Import.php

like image 127
T.Todua Avatar answered Oct 22 '22 14:10

T.Todua