Jump to content

PHP MySQL Problem driving me mad - PLEASE help!!!!


daveeboi

Recommended Posts

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?

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.