By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,050 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,050 IT Pros & Developers. It's quick & easy.

Backing up a database table with PHP

P: n/a
I would like to backup a database table using PHP (I can't use the simpler
shell command for MySQL). I came across a line of code to do write the
table into a file, so mine is as follows:

$res = mysql_query("SELECT * INTO OUTFILE 'php\admin\db.csv' FIELDS
TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\"' ESCAPED BY '\\' LINES
TERMINATED BY '\r\n\' from $TableName");

$TableName already declared, and the right database is open (using echo
command to print the variables to make sure).

But when the script is run, the file is indeed created in the correct
directory, but is completely blank (zero bytes in length).

I do not know what I'm doing wrong, and this function is not too well
documented - at least - especially not for a newbie. Can anyone help me?

Thanks

Dariusz
Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.