Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old November 10th, 2003, 09:33 PM
prycejones prycejones is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 87 prycejones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 44 sec
Reputation Power: 2
Send a message via ICQ to prycejones
mysqldump unavailable

Hi all,
I am writing a backup script for my users who have a mysql table on a database on a remote webserver.

Primarily I want the script to download a file full of the sql statements to rebuild that table.

This is not a problem for *me* as my webhoster has phpmyadmin and backup-facilities available via my control panel, but I dont want my users near this control panel and also this would not be automatic enough (and fool proof) for them.

I have tried my script running on my own server (running mysql) and I use MYSQLDUMP and all works fine.

However, on asking my webhoster, he is not comfortable in setting this up for me (perhaps he doesnt know how to or he may be thinks it is unsafe??).

Does anybody know how to dump a table without using mysqldump hopefully with sql statements, or has anyone had similar problems?

Obviously I could write some complex code to go through all columns and write it all out but I dont want to re-invent the wheel.

Thankyou

Pryce


Reply With Quote
  #2  
Old November 18th, 2003, 05:36 AM
nazly nazly is offline
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Colombo,SriLanka
Posts: 1,325 nazly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 18 sec
Reputation Power: 3
Send a message via Yahoo to nazly
RE: mysqldump unavailable

You can use the SELECT statement inorder to save all the data in a table into a text file..

Here is the syntax

SELECT a,b,a+b INTO OUTFILE "/tmp/result.text"
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY "n"
FROM test_table;

Better read the mySQL manual..
http://www.mysql.com/doc/en/SELECT.html
http://www.mysql.com/doc/en/LOAD_DATA.html

I hope you can workaround and get some useful informartion

Reply With Quote
  #3  
Old November 18th, 2003, 10:18 AM
prycejones prycejones is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 87 prycejones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 44 sec
Reputation Power: 2
Send a message via ICQ to prycejones
RE: mysqldump unavailable

Thanx for that Naz.
It seems that my webhoster has a problem in letting me do that to <sigh> as I get access denied when I run it that command.

So, I did reinvert the wheel after all and I wrote all the code myself. And, if I can say so myself, I think it rocks too!

I have one small problem with importing data like this....
data data blah <blah> data data
It misses out the second blah as it think it is html

When it is done I plan on posting the code to the code section here.

THanx for the interest.

p


Reply With Quote
  #4  
Old November 18th, 2003, 02:50 PM
nazly nazly is offline
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Colombo,SriLanka
Posts: 1,325 nazly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 18 sec
Reputation Power: 3
Send a message via Yahoo to nazly
RE: mysqldump unavailable

I think you better take a look at this function.. Its htmlentities().. I love this function when it comes to converting HTML characters. Specially the optional second quote_style parameter is an added advantage..

Reply With Quote
  #5  
Old November 18th, 2003, 05:31 PM
prycejones prycejones is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 87 prycejones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 44 sec
Reputation Power: 2
Send a message via ICQ to prycejones
RE: mysqldump unavailable

Thanx Naz'
I used your suggestion in conjunction with addslashes and all is great.

ie
echo "'" . addslashes(htmlentities($val)) . "'" ;
Thanx very much

Pryce

Reply With Quote
  #6  
Old November 18th, 2003, 05:36 PM
nazly nazly is offline
Codewalkers Beginner (1000 - 1499 posts)
 
Join Date: Apr 2007
Location: Colombo,SriLanka
Posts: 1,325 nazly User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 18 sec
Reputation Power: 3
Send a message via Yahoo to nazly
RE: mysqldump unavailable

Quote:
echo "'" . addslashes(htmlentities($val)) . "'" ;


Without addslashes you can use that optional second parameter I mentioned. It will convert both double and single quotes.

php Code:
Original - php Code
  1.  
  2. echo "'".htmlentities($val,ENT_QUOTES)."'";

Reply With Quote
  #7  
Old November 18th, 2003, 05:56 PM
prycejones prycejones is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 87 prycejones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 44 sec
Reputation Power: 2
Send a message via ICQ to prycejones
RE: mysqldump unavailable

ah ha

gr8


thanx alot

p

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > mysqldump unavailable


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway