How to use php program export mySQL Data to excel files...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kennie1112
Forum Newbie
Posts: 6
Joined: Tue Oct 26, 2004 2:33 am

How to use php program export mySQL Data to excel files...

Post by kennie1112 »

Dear all,
Can you tell me...how to use php program export mySQL Data to excel files? (Save excel file into my PC)
I already use "INTO OUTFILE", but not work...
Please tell me why... :cry:

Error Message:

SQL-query :

SELECT uid, fullname
INTO OUTFILE 'c:/result.txt'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM users
ORDER BY partnumber

MySQL said:


Access denied for user: 'sa6@localhost' (Using password: YES)
[php_man][/php_man]
swdev
Forum Commoner
Posts: 59
Joined: Mon Oct 25, 2004 8:04 am

Post by swdev »

Several things to check

1) Have you logged into MySQl with the correct username and password?
2) Have you used the correct database (i.e. issued a USE DATABASE
command)?
3) Does this user have the correct privileges to read from the 'users' table?
4) Does this user have the 'FILE_PRIV' privilege to write to the operating system?

Note, if you rename the file to 'c:/results.csv' then double-clicking on the file wiill automatically open the file in Excel.

Hope this helps
kennie1112
Forum Newbie
Posts: 6
Joined: Tue Oct 26, 2004 2:33 am

Post by kennie1112 »

Thanks! I know why porblem la...
Because I no call the database in module...so...hahaha)))
But thanks you tell me what problem. :D
Post Reply