Closed Thread
Results 1 to 6 of 6

Thread: Database backup, with a twist.

  1. #1
    Chrisms is offline Newbie
    Join Date
    Aug 2006
    Location
    NJ
    Posts
    28
    Rep Power
    0

    Database backup, with a twist.

    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.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Jordan Guest
    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
    ...... 

  4. #3
    falco85 is offline Programmer
    Join Date
    Apr 2006
    Posts
    105
    Rep Power
    0
    I think he is looking to export Jordan since he did say "Backup", right?

  5. #4
    Chrisms is offline Newbie
    Join Date
    Aug 2006
    Location
    NJ
    Posts
    28
    Rep Power
    0
    Quote Originally Posted by falco85 View Post
    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..

  6. #5
    Lop's Avatar
    Lop
    Lop is offline Speaks fluent binary
    Join Date
    May 2006
    Posts
    1,178
    Rep Power
    30
    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.

  7. #6
    Chrisms is offline Newbie
    Join Date
    Aug 2006
    Location
    NJ
    Posts
    28
    Rep Power
    0
    Quote Originally Posted by Lop View Post
    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.
    you're missing my point, I really am not lookgin foward to sitting down, and writing roughly 500 lines of SQL create tables, collums, etc.

    I'm looking for a program, that takes a database file, and outputs PHP to create that database.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. AUtomatic database backup oracle10g
    By shivam in forum Database & Database Programming
    Replies: 1
    Last Post: 07-07-2011, 04:01 AM
  2. Hello from XZ Backup!
    By xzbackup in forum Introductions
    Replies: 4
    Last Post: 04-17-2011, 02:44 PM
  3. Backup?
    By Grub in forum Linux/Unix General
    Replies: 8
    Last Post: 11-30-2008, 08:08 AM
  4. Shell: MySQL Database Backup
    By Jordan in forum Tutorials
    Replies: 0
    Last Post: 08-15-2006, 01:18 PM
  5. Backup Projects
    By Crane in forum Software Development Tools
    Replies: 3
    Last Post: 07-04-2006, 05:49 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts