|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today! |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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..
|
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
RE: mysqldump unavailable
Quote:
Without addslashes you can use that optional second parameter I mentioned. It will convert both double and single quotes. |
|
#7
|
|||
|
|||
|
RE: mysqldump unavailable
ah ha
gr8 thanx alot p |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > mysqldump unavailable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|