I have a mysql query written in PHP as follows: SELECT * FROM table OUTPUT INTO 'test.txt' PHP: Now, that query actually works, but I don't know where to find the file on the server. And, whenever I try to specify the output address, as in: SELECT * FROM table OUTPUT INTO '/var/lib/mysql/data/public/test.txt' PHP: I get error codes. Looking for advice on how I can both run the query successfully AND locate the file that it outputs. Thanks, BRian
Try SELECT [COLOR=#339933]*[/COLOR] FROM table OUTPUT INTO [COLOR=#0000FF]'/tmp/test.txt'[/COLOR] Code (markup):
Thanks, but the problem is I'm on a shared hosting plan and I can't even locate the tmp directory to retrieve the file. The point is moot, anyway, because when I try /tmp/test.txt I just get an error code. When I use 'test.txt', the statement works -- but again, I can't find the "test.txt" file on any of the directories available to me in my shared hosting plan.
Try this $dest = dirname(__FILE__); $sql = "SELECT * FROM table INTO OUTFILE '$dest/test.txt'"; mysql_query($sql) || die(mysql_error()); Code (markup):
I get the following error message when I run the code: Errcode: 13 I guess it's either a permissions issue or due to some feature that my shared hosting provider has disabled "for security reasons" The odd thing is, I don't get an error message with The only problem is-- I don't know where it's sending the file. I can't find it on the directories that my shared hosting provider lets me see via FTP.
Error 13 means "permission denied". Try to add write perms (chmod 777) the folder of you script and try again. When using 'test.txt', the file's directory is mysql data dir.
That's done it. It works great after changing permissions and using your suggested script. Thanks for the help!!!