Does anyone has the code of exporting the database structure and information to a file?
My problem, is that the file must be downloaded over internet. So when a user is clicking on the "Back-up" button the "Save to" window must appear.
I've tried to take a look in the php admin but i couldn't understand that.
Export/Backup database to a file
Moderator: General Moderators
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
Hi there
If your database isn't to complex you could dump data into a file which you throw at the user (webclient). How to redirect a SELECT query into a file is described in the MySQL manual:
http://www.mysql.com/doc/en/SELECT.html
If your database isn't to complex you could dump data into a file which you throw at the user (webclient). How to redirect a SELECT query into a file is described in the MySQL manual:
http://www.mysql.com/doc/en/SELECT.html
-
fastfingertips
- Forum Contributor
- Posts: 242
- Joined: Sun Dec 28, 2003 1:40 am
- Contact:
Run something similiar to this:
...and after the query is done, you could simply
Lookup header() in the php manual, and look at the user comments to find out how you could initiate downloads directly using it.
Just ideas.
Code: Select all
SELECT a,b,a+b INTO OUTFILE 'result.txt'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM yourtable;Code: Select all
header("Location: http://www.example.com/result.txt");Just ideas.