I'm busy creating a website, and I thought it would be a good idea to have some kind of database backup since it is very database oriented. Is there a way of doing this in PHP so that the backed up tables can be downloaded through my web browser?
I tried:
but this gets deposited on the server. Is there any way of getting it from there through PHP?
I also tried:
which doesn't work. That, I've figured, is because I need one variable per column.
The only other way I can think of is to loop through all the data in the table and manually put that in a file, which I can then later use for restoration purposes if needed.
Anyone know what I should do?
EDIT:
Never mind, I found a way to do it at http://www.greenbird.info/xantus-webdevelopment/backup_database_with_php.
I tried:
Code:
mysql_query("SELECT * INTO OUTFILE 'filename' FROM TableName");
I also tried:
Code:
mysql_query("SELECT * INTO @BackupVar FROM TableName");
$data = mysql_result(mysql_query("SELECT @BackupVar"));
The only other way I can think of is to loop through all the data in the table and manually put that in a file, which I can then later use for restoration purposes if needed.
Anyone know what I should do?
EDIT:
Never mind, I found a way to do it at http://www.greenbird.info/xantus-webdevelopment/backup_database_with_php.
Last edited: