Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Getting a SQL dump from php
Old 09-10-2007, 05:13 AM Getting a SQL dump from php
liam1412's Avatar
Novice Talker

Posts: 10
Name: Liam O'neill
Trades: 0
Hi

I am at work and despeprately need a sql dump of my site so I can upload to my local phpmyadmin. Is there a php function that can do this.

Thanks
Liam
__________________

Please login or register to view this content. Registration is FREE
- A German Car Enthusiasts Forum

Please login or register to view this content. Registration is FREE
- UK Angling Forums
liam1412 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-10-2007, 09:34 AM Re: Getting a SQL dump from php
Skilled Talker

Posts: 62
Name: Tom Wright
Location: Brighton, UK
Trades: 0
Try this:
First open the relevant connection as you would normally when using a database. Now use the following php:
PHP Code:
 $tableName  'name_of_table';
$backupFile 'backup/table.sql';
$query      "SELECT * INTO OUTFILE '$backupFile'       FROM $tableName";
$result mysql_query($query); 
Simply repeat for all the tables you need backing up.
Hope this helps, Tom
__________________
My site:
Please login or register to view this content. Registration is FREE

Last edited by tomythius; 09-10-2007 at 09:34 AM.. Reason: Dodgy formatting
tomythius is offline
Reply With Quote
View Public Profile
 
Old 09-10-2007, 10:33 AM Re: Getting a SQL dump from php
Super Spam Talker

Latest Blog Post:
PSD Squirrel Launched
Posts: 932
Trades: 7
do you have shell access, liam?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Sir P is offline
Reply With Quote
View Public Profile Visit Sir P's homepage!
 
Old 09-10-2007, 02:08 PM Re: Getting a SQL dump from php
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
You can do this if your server has PHPmyadmin (or similar) where you jsut EXPORT it.

have a look in PHPMyAdmin and it has a Export link, select what you want (probably the default and SQL format)
you can copy it and run the code, or save to a txt file and uplaod to PHPmyadmin and it will run it for you.

Hope this helps
Talkupation appreciated.
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 09-10-2007, 03:26 PM Re: Getting a SQL dump from php
Super Talker

Posts: 130
Trades: 0
this is what I use:

mysqldump [options] db_name [tables]

reference:
http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html
__________________
flann

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
flann is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Getting a SQL dump from php
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17681 seconds with 12 queries