ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-db
php-db
[PHP-DB] mysqldump via php
by Jeffrey other posts by this author
Jun 29 2006 4:23AM messages near this date
Re: [PHP-DB] LIMIT | RE: [PHP-DB] mysqldump via php
I would like to do a backup of an entire MySQL database via php. My 
thought was to use mysqldump, write the data to a file and save the 
file. However...

	$query="mysqldump $dbase";
	$result=mysql_query($query) or die(mysql_error());

...immediately results in an "error in your SQL syntax near mysqldump 
[database name]".

The reason I want to do a MySQL back up via php is that I have a web 
application in which the user can archive a project, which involves 
moving a lot data from one set of tables to another set of tables. The 
user can also delete a project, which removes lots of data from the DB 
altogether. Although there are lots of "Are you sure you really want to 
do this?" messages the user must click upon, I am sure I will eventually 
get a user telling me she accidentally archived/deleted stuff and can I 
help.

So, my thought was to do a incorporate a mysqldump in the 
archiving/delete page. That way there would be a snapshot of the 
pre-action db, making it easy to put things right.

Can you help with my query - or by suggesting an alternative solution?

Thanks,

Jeffrey

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Jeffrey
Bastien Koert
Adrian Bruce
Miguel Guirao
Jeffrey

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved