Reputation: 11
I am trying to generate a file from mysql. The I am using is:
SELECT * INTO OUTFILE $_SERVER['DOCUMENT_ROOT']/data.txt FIELDS TERMINATED BY ',' FROM admin";
The code is working fine as I am not getting any error. But the problem is I could not locate where the file is created. Would any body please help me.
I am using a shared hosting.
Thanks
Upvotes: 1
Views: 3945
Reputation: 1161
you are using shared hosting then good way to connect ftp and get the path of physical working directory, you can get form "pwd" linux command
use that path because at the shared host make some time issue
Upvotes: 0
Reputation: 57650
The query should be run like this, I mean it should be quoted.
mysql_query("SELECT * INTO OUTFILE '{$_SERVER['DOCUMENT_ROOT']}/data.txt' FIELDS TERMINATED BY ',' FROM admin";");
To successfully run this query you'll need these
FILE
privilege$_SERVER['DOCUMENT_ROOT']/data.txt
. And this directory must be accessible. Upvotes: 1