PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Mar 27, 2017 11:37 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Oct 13, 2016 2:47 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4144
Location: United Kingdom
We have backups of our websites, but I would like to be able to click a button in our own CMS that saves either some fundamental tables, or ALL tables. So it basically does what the phpmyadmin 'export' to .sql does.

How does one go about that?

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Thu Oct 13, 2016 7:04 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6193
Location: Montreal, Canada
You can't stick with mysqldump at the command line? Or a manual export when you need one?

Syntax: [ Download ] [ Hide ]
So it basically does what the phpmyadmin 'export' to .sql does.

phpMyAdmin is written in PHP. Have you taken a look at how they do it?

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Thu Oct 13, 2016 7:11 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4144
Location: United Kingdom
I can login to the control panel system, and go thru the various buttons to get there - but we regularly work in the CMS for the website so I wondered if I could do it from there instead.

I don't quite know where in phpmyadmin that code would be. But I figured there would be an easy way to do it anyway.

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
PostPosted: Thu Oct 13, 2016 7:14 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6193
Location: Montreal, Canada
You basically need the schema definitions, SELECT * from each table, and write to file. What have you tried so far?

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Thu Oct 13, 2016 7:21 am 
Offline
DevNet Master

Joined: Wed Oct 08, 2008 3:39 pm
Posts: 4144
Location: United Kingdom
I Tried this simple query:

Syntax: [ Download ] [ Hide ]
<?php
include "dbconn.php";
mysql_query("SELECT * FROM products INTO OUTFILE '/tmp/products.sql'");
echo "yes";
?>

_________________
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group