Hey, I'm looking to backup my database, but, instead of saving it as a .sql or whatnot, havin git write PHP code to build the database. Is this possible? Do any of you know of any exsiting programs that will take a mysql database backup file, and build a php file to build that database? If not, i guess i'll have fun writing my own, just would be faster if i didn't have to write my own. haha.
hmm, I'm not sure what you mean. You want a PHP app to build your database from a exported .sql file?
If so, you can just load the SQL from the backup file as a query and execute the query. When you export as SQL the SQL code in the file will execute as a query.
So basically build your fopen and do
Code:// Connec to SQL
.......
// Open/Read file
$fp = fopen("sqlfile.sql","r");
$query = fread($fp);
// Execute the query
$results = mysql_query($query);
// close your connects
......
I think he is looking to export Jordan since he did say "Backup", right?
sorry, it's kind of not normal.
i have a database shell, with nothign in it. i want to make a backup of that database, only, instead of the normal backup file, i wish to have it be PHP'd, in the sense where you can run the .php file on ANY server, and it'll create the shell.
i wish to dstribute a program i'm making, (it's not nearly done yet, just thinking ahead.) and i don't want to rely on the end user to know how to use a .sql backup, rather have them ust go to a PHP file that creates the database, tables, etc, and then have them delete that file, to prevent dataloss in the future.
sorry i wasn't clear the first time around, i wish it had a name, it probably does, but i just dont know it..
ahh, so, will it be the same .sql file for every install? You could do an extract on your computer and just manually make it into PHP. Do what Jordan did above and just add the SQL into the PHP instead of using a file. That is what most commerical PHP applications do these days.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks