Page 1 of 1

exporting data from mysql database

Posted: Tue Jan 09, 2007 1:06 am
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

Posted: Tue Jan 09, 2007 2:25 am
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.

Posted: Wed Jan 10, 2007 4:27 am
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