I want to export two tables from my mysql server to a csv file on the webserver.
Both the mysql and webserver are running on the same machine, and will NOT be web-facing. It's merely a small webapp to automate a task I perform on a regular basis, and so security is not an issue.
The way I tried, which would be absolutely ideal, but did not work was:
$exportArticle = 'SELECT *
INTO OUTFILE "article_line.csv"
FIELDS TERMINATED BY ","
ENCLOSED BY "\""
ESCAPED BY "\\"
LINES TERMINATED BY "\\n\\r"
FROM article_line';
and then calling it in my script with:
mysql_query($exportArticle);
But unfortunately this doesn't write anything (it doesn't error out, either, though.)
If someone could help me with this, that would be great! Thanks
EDIT: Just to clarify, I have spent the last 2 and a half hours browsing both google and stackoverflow looking for solutions for this, and have tried so many different ways it's not funny. It's just ending up a muddle in my head that I can't understand, so apologies if anyone believes the answer is already here - it hasn't worked for me so far.