Below outputs data to any folder ($PATHFILE) I specify:
$query = "SELECT * INTO OUTFILE '$PATHFILE' FROM customers";
$result = mysql_query($query);
However, I want to export this code's output to any server folder I specify too. But it seems to be only for downloading to my Desktop:
$sql = mysql_query("SELECT * FROM customers"); // select shippable products only!
while($row = mysql_fetch_array($sql))
{
$contents.=$row['firstName']."\t";
$contents.=$row['lastName']."\t";
$contents.=$row['address1'] ."\t";
$contents.=$row['address2'] ."\t";
$contents.=$row['city']."\t";
$contents.=$row['state']."\t";
$contents.=$row['zip']."\t";
$contents.=$row['country']."\t";
$contents.=$row['phone']."\n";
}
header("Content-type: application/x-msdownload");
header("Content-Disposition: attachment; filename=customers.txt");
header("Pragma: no-cache");
header("Expires: 0");
print "$contents";
I don't mind the first, but I would like more flexibility with the outputs.
Am I able to auto-save the second code to folders on the server?
thanks