dsaxw4201 2014-05-24 08:39
浏览 36
已采纳

SQLSTATE [42000]:使用csv export相关的php脚本语法错误或访问冲突

I'm customizing a csv export php script which I admit I took from the internet but

I'm having this error

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\',\' optionally enclosed by \'\'' at line 1

The line of code described is

$fnam2 = 'data-' . substr(md5(microtime()), 0, 8); 
$setsu->query("SELECT * FROM ".$tblname." into outfile '".$fnam2 ."' fields terminated by \',\' optionally enclosed by \'\'");

Which was originally

$setsu->query("SELECT * FROM ".$tblname.". ' into outfile "c:/xampp/htdocs/' . $fnam2 . '" fields terminated by \',\' optionally enclosed by \'"\'');

I would like the remove the part where it points to xampp folder so that the user can place wherever she/he wants to download the file.

Any help appreciated.

  • 写回答

1条回答 默认 最新

  • douxianji3367 2014-05-24 09:04
    关注
    $fnam2 = 'data-' . substr(md5(microtime()), 0, 8); 
    $setsu->query("SELECT * FROM ".$tblname." into outfile '".$fnam2 ."' fields terminated by \",\" optionally enclosed by '\"'");
    

    Maybe?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 arduino控制ps2手柄一直报错
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥85 maple软件,solve求反函数,出现rootof怎么办?
  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题