I'm used to downloading my mysql data in csv format with this php tutorial:
http://www.phpfreaks.com/tutorials/114/0.php
However, I wrote a cron to auto save my data to a folder, but I've assumed that this code will save the data to the same directory as my php script resides.
Is there a tutorial that explains how to save mysql data, in csv, to any directory I wish? Without needing to download it!
so far all I have found online are sketchy tutorials, and this is what I've created:
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'password';
$dbname = 'database';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
mysql_select_db($dbname);
$tableName = 'tablename';
$backupFile = 'file.sql';
$query = "SELECT * INTO OUTFILE '$backupFile' FROM $tableName";
$result = mysql_query($query);
However, nothing seems to happen, and no errors are logged either.