exporting data from mysql database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
mister
Forum Newbie
Posts: 7
Joined: Sat Jan 06, 2007 11:38 am

exporting data from mysql database

Post by mister »

hi......

im using this command to take the data from my table in mysql
$sql1="SELECT * into outfile '/tmp/text' from websites ";

and when i add a new data to the table and try to use this command a gain i it give me this error
Error: File '/tmp/text' already exists

but i must overwrite on the same file text so any body have any idea
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

http://dev.mysql.com/doc/refman/5.0/en/select.html wrote:file_name cannot be an existing file, which among other things prevents files such as /etc/passwd and database tables from being destroyed.
You'll need to delete the file using unlink() before calling the query.
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

Refer to this url if you're loading data into mysql from text file :
http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html
Post Reply