In my website, everytime i delete a user, i backup their whole profile and related data into a sql file.
a sql backup for a given user will look like this
[code]USE database_name; //tell which database to insert data.
INSERT INTO table1 VALUES();
INSERT INTO table2 VALUES();
INSERT INTO table3 VALUES();[/code]
[sub]note: a real back up sql file will contain hundred of rows.[/sub]
Now i decided to integrate into my website a way to restore a deleted user, by reading the sql codes from the file into a variable and execute it back to the database. I’m already up to the point where the $var just hangs in there with the whole file waiting for me to do something with it.
I was reading php functions such as exec & shell_exec which i’m unfamiliar with.
my goal is to run the whole file into the database at once. i’m trying to avoid a loop to run row by row.
any advice/approach or point to the right direction is greatly appreciated.