0

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 Answer 1

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

Maybe?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.