daveeboi Posted August 7, 2008 Share Posted August 7, 2008 Am trying to get the results of a query to export into a CSV file, but all I keep getting is an error message. PHP Code: $sql = "SELECT * FROM tbl_qualifications INNER JOIN tbl_users ON tbl_qualifications.UserID=tbl_users.ID WHERE tbl_qualifications.QID=24 AND tbl_users.PrefCom=2 INTO OUTFILE '/downloads/file.csv'"; Error message: Can't create/write to file '\downloads\file.csv' (Errcode: 2) The folder is created, and has permission to write to it. Don't know what's going on?? Can anyone help? Link to comment https://forums.phpfreaks.com/topic/118639-php-mysql-problem-driving-me-mad-please-help/ Share on other sites More sharing options...
blirette Posted August 7, 2008 Share Posted August 7, 2008 Hey, I used this kind of thing to generate a file from an SQL query before. Worked great. header('Content-type: application/x-msexcel; charset=utf-8'); header('Content-Disposition: attachment; filename="somefile.csv"'); Then here you echo() all your information. Hope it helps! Link to comment https://forums.phpfreaks.com/topic/118639-php-mysql-problem-driving-me-mad-please-help/#findComment-610781 Share on other sites More sharing options...
sasa Posted August 7, 2008 Share Posted August 7, 2008 are you shure that your path to file is OK try to use full path Link to comment https://forums.phpfreaks.com/topic/118639-php-mysql-problem-driving-me-mad-please-help/#findComment-610872 Share on other sites More sharing options...
DarkWater Posted August 7, 2008 Share Posted August 7, 2008 Yeah, I noticed the beginning / which indicates the root filesystem directory. Are you sure that's where it is? Link to comment https://forums.phpfreaks.com/topic/118639-php-mysql-problem-driving-me-mad-please-help/#findComment-610875 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.