gpt4 book ai didi

php - mysql导出csv时出错

转载 作者:行者123 更新时间:2023-11-29 20:53:30 25 4
gpt4 key购买 nike

新手,我创建了以下查询来从数据库中选择并导出为 csv,但我不断收到错误:

$query = "SELECT firstname,lastname,phone,email WHERE firstname = 'Trenton' INTO OUTFILE 'C:/tjtest2.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n' FROM students";
$result = mysql_query($query) or die('error');
if($result)
{
echo"yes!";
}
else
{
echo"NO!";
};

我可怕的芯片错误不断出现,但我不知道问题出在哪里

最佳答案

您需要在条件之前从学生那里使用

$query = "SELECT firstname,lastname,phone,email form students WHERE firstname = 'Trenton' INTO OUTFILE 'C:/tjtest2.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n'";

关于php - mysql导出csv时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37825778/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com