i write simple Query in php for export data in CSV file but something is wrong with my Query of Syntex Error, can anyone tell me how to solve this? sorry for this liitle question, i m new in PHP.
$CSVQuery= "SELECT * FROM table INTO OUTFILE '/tmp/orders.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '/n' ";
I think Query should be as below:
$CSVQuery= "SELECT * INTO OUTFILE '/tmp/orders.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '/n' FROM table ";
For more details refer this link : MySQL Tutorial
Escape the quote in your code and use a backslash for the ...
$CSVQuery= "SELECT * FROM table INTO OUTFILE '/tmp/orders.csv' FIELDS TERMINATED BY ','
ENCLOSED BY '\"' LINES TERMINATED BY '
' ";