Helo everyone !
I find this problem and I think I am close to the solution but ...
The question: I need to import a few thousand of record storee in a *.csv
file on my local harddisk, with my php application, managing my mysql engine.
So, in command line, all works fine, all records are
I could be 100% wrong on this, but I do not think that a command line
statement can be executed through mysql_query() - try exec().
If I remember correctly mysql load data infile ... is not executed from
within mysql, but at the command line.
(Hint: look at the source for phpMyAdmin and copy
You can definitely do a load file from within the mysql client, so I'd
guess you can do it through mysql_query, too. I'm wondering about the
semi-colon within the query. Maybe it needs to be escaped, too.
David
I could be 100% wrong on this, but I do not think that a command line
statement
where you open
the file and read it in, parsing thru it to access the data elements and
running sql statements thru a loop
Bastien
From: [EMAIL PROTECTED]
To: Miles Thompson [EMAIL PROTECTED]
CC: php-db-list php-db@lists.php.net
Subject: Re: [PHP-DB] load data infile -- problem
Date: Thu, 18
Hello,
I have a page with a button that when clicked loads a pre-determined
text file into my database. The code is posted below.
However, when clicked the button does nothing, just opens up the same
page again. The data does not get loaded into the database. any ideas?
Thanks
Justin
The
]
Subject: Re: [PHP-DB] Load data infile problem
does your server have the post variables set as globals? you might
have to use $_POST['submit'] instead.
On Jun 7, 2004, at 9:17 PM, [EMAIL PROTECTED] wrote:
Hello,
I have a page with a button that when clicked loads a pre-determined
text file
I have a called file cats.txt which count data that were solitary of a DB
Access.
I need to export these data for a table 'cats' inside of a DB done in MySql.
In MySql I can execute this procedure in the following way:
Load data local infile gatos.txt
into table gatos
fields
terminated by ','
You running Windows or *nix? File permissions will play a part in this,
but use PHP's exec() function to execute MySQL's load data infile. The
manual has a number of well annotated examples. The big problem may be that
you'll be executing the command as whatever user the web server is running