i am fairly new to php but i have mysql down to an art and i would like to create a php page that restores my database im kinda curious how to get this thing rolling. If anyone has any ideas i would greatly appreciate them.
thanks
php mysql question
Moderator: General Moderators
Do you mean restoring your database from a mysqldump file? As far as I know, PHP doesn't have anything built in that deals with mysqldump or restoring from files. However, you can use PHP to call shell commands, which could restore just fine.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
PHP has 3 different ways to call shell commands. shell_exec() and the backtick operator (`) are analogous, return the output from the command, and are disabled in safe mode. exec() just executes the command and may or may not be disabled in safe mode (couldn't find any info either way)
...should be what you're looking for.
Code: Select all
$return_value = shell_exec('mysql -u root -proot_password test_database < dump_file.sql');Real programmers don't comment their code. If it was hard to write, it should be hard to understand.