Jump to content
xisto Community
Sign in to follow this  
Arne-Christian

How To Create Mysql Backups Using Php

Recommended Posts

Does anyone here on this forum got any idea how to create backups of MySQL Databases using PHP then download the backup to the user, using:

Header("Content-type: application/octet-stream");Header("Content-Disposition: attachment; filename=$file_name");
??

Share this post


Link to post
Share on other sites

I assume you are asking about the php code for that? and not using phpadmin? or the cpanel backup system?

Share this post


Link to post
Share on other sites

Suggestion: try doing a search on the keywords +download +php +mysql here (or maybe try over at the Xisto Forum (http:http://forums.xisto.com/)).The Xisto Forum is more technical than the Trap and may have the information you are seeking.

Share this post


Link to post
Share on other sites

Dear Arne-Christian if you want make one mysql tabel with php use this :

After all you must connect at your db
use this code :

$dbusername = "root"; //write Database username$dbpassword = ""; // write database password$dbname = "famp3";  //write database namemysql_connect("localhost","$dbusername","$dbpassword") or die(mysql_error()); mysql_select_db("$dbname") or die(mysql_error());


mysql_query("Put Your Query here ");

Example :
CREATE TABLE album (id tinyint(4) NOT NULL auto_increment,name text NOT NULL,country text NOT NULL,image text NOT NULL,cat text NOT NULL,date text NOT NULL,artist text NOT NULL,artistabc text NOT NULL,rate int NOT NULL,PRIMARY KEY (id)) TYPE=MyISAM;

You can use this code to make one tabel in mysql by php
if you want make one mysql database , you must create one db at your cpanel ( with one username and password )

You can use backup (export) query

have good time
Edited by farsiscript (see edit history)

Share this post


Link to post
Share on other sites

1) Thanks for responding...2) ...Do you think i didn't knew that before? i have been working with mysql for months, anyway i have created a class now for creating backups, Thanks to google :) and you can create databases with "CREATE DATABASE $dbName" there is no need for cPanel if you know basic stuff, just had to say that, anyways no more respondes needed :P

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.