I have script that will get my sql results and add it into a csv. But seems like it doesn't want to save into the directory am running the script.
My script
/* Connecting, selecting database */
$db_link = mysql_connect("localhost", "root", "");
if (!$db_link) {
die("Could not connect: " . mysql_error());
}
mysql_select_db("mydb") or die("Could not select database");
/* Performing SQL query */
$sql_1="SELECT id,date,ref_id,new_id INTO OUTFILE 'file.csv' FIELDS TERMINATED BY ',' ";
$sql_2="OPTIONALLY ENCLOSED BY '"."\"' ";
$sql_3="LINES TERMINATED BY '"."\\n' FROM check_log";
$sql = $sql_1.$sql_2.$sql_3;
mysql_query($sql,$db_link);
/* Closing connection */
mysql_close($db_link);
echo "DONE";