Backing up a database table with PHP

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dariusz

    #1

    Backing up a database table with PHP

    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("SE LECT * INTO OUTFILE 'php\admin\db.c sv' 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
Working...