Hello to all . I use the code below to make a backup of my tables in my database. The problem is that the backup is generated in the mysql directory(the same one as the original database) Any ideas to alter the code in order to have the back up in my project directory under backup subfolder? Because i make a share code for my job anyone can have the project in different directories... THANK YOU FOR YOUR TIME. //THE CODE <?php require_once("includes/connections.php"); require_once("includes/constants.php"); ?> <html> <head> <title>ΕγγÏαφή ΔεδομÎνων</title> </head> <body> <?php $tableName = array("monades", "elements"); $a=0; while ($a<2) {$pinakas=$tableName["$a"]; $backupFile = "{$pinakas}".".sql"; $query = "SELECT * INTO OUTFILE '$backupFile' FROM $pinakas"; $result = mysql_query($query); global $a; $a++ ; } ?> <?php include("includes/close_connection.php"); ?> </body> </html>
May be try this to backup in current folder then move the file Moving file to required location But requires testing. regards
thid seems to work fine for me but how i will make it to work if some one has changed the Working directory for example instead of C:/wamp/www/STANDARIZATION C:/wamp/www/ISO <?php $tableName = array("monades", "elements"); $a=0; while ($a<2) {$pinakas=$tableName["$a"]; $backupFile = "{$pinakas}".".sql"; $query = "SELECT * INTO OUTFILE '$backupFile' FROM $pinakas"; $result = mysql_query($query); global $a; rename("C:/wamp/bin/mysql/mysql5.0.51b/data/db_army/$backupFile ", "C:/wamp/www/STANDARIZATION/backup/$backupFile"); $a++ ; } ?>