Page 1 of 1

Exporting data from a MySQL table to a CSV file

Posted: Tue Aug 17, 2004 2:20 am
by visionmaster
Hello,

I want to export some data from a MySQL table to a CSV file using OUTFILE.

Code: Select all

<?php
include_once "modules/mod_datenbank.php";
$db = dbconnect();                                            
$query = mysql_query("SELECT idLink, dbLink
                        FROM links
                        WHERE dbFlag = '1'
                         INTO OUTFILE '/opt/lampp/htdocs/tarazi/phpcrawler/development/logfiles/data.txt'
                       FIELDS TERMINATED BY ','
                      LINES TERMINATED BY '\n' ") or die ("Ungültige Abfrage: " . mysql_error());
                                
$result = mysql_query($query);        

?>

Output:
--------
Unallowed Query: Access denied for user: 'pma@localhost' (Using password: YES)

Folder /logfiles has following rights drwxrwxrwx.

=> What is the error? How do I get it running?

Thanks

Posted: Tue Aug 17, 2004 3:02 am
by Vicious
chmodd folder and file to 777

Posted: Tue Aug 17, 2004 6:26 am
by visionmaster
Vicious wrote:chmodd folder and file to 777
I inserted following line before my query:

chmod ("/opt/lampp/htdocs/tarazi/phpcrawler/development/logfiles/", 755);

Output:
---------
Warning: chmod(): The operation is not allowed in in /opt/lampp/htdocs/tarazi/phpcrawler/development/export.php on line 13
Ungültige Abfrage: Access denied for user: 'pma@localhost' (Using password: YES)

Posted: Tue Aug 17, 2004 10:32 am
by feyd
chmod it inside your ftp program, or from cpanel or what have you. Your mysql user may not have OUTFILE rights as well..