Reputation: 12764
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.
Upvotes: 0
Views: 106
Reputation: 3205
$fnam2 = 'data-' . substr(md5(microtime()), 0, 8);
$setsu->query("SELECT * FROM ".$tblname." into outfile '".$fnam2 ."' fields terminated by \",\" optionally enclosed by '\"'");
Maybe?
Upvotes: 1