我在php中为CSV文件中的导出数据编写简单查询但是我的Syntex错误查询有问题,有人能告诉我如何解决这个问题吗?抱歉这个小问题,我是PHP新手。
$CSVQuery= "SELECT * FROM table INTO OUTFILE '/tmp/orders.csv'
FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '/n' ";
答案 0 :(得分:0)
转义代码中的引号并使用\n
的反斜杠...
$CSVQuery= "SELECT * FROM table INTO OUTFILE '/tmp/orders.csv' FIELDS TERMINATED BY ','
ENCLOSED BY '\"' LINES TERMINATED BY '\n' ";
答案 1 :(得分:0)
我认为查询应该如下:
$ CSVQuery =“SELECT * INTO OUTFILE'/tmp/orders.csv'FIELDS TERMINATED BY',''''''''''''''''''''''''''''''''''''
有关详细信息,请参阅此链接:MySQL Tutorial