Re: Errcode: 2 when running LOAD DATA LOCAL INFILE on server
| From: | Yeong CN | Date: | Sat, 18 Aug 2001 03:08:44 +0000 |
| Subject: | Re: Errcode: 2 when running LOAD DATA LOCAL INFILE on server | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-63265@lists.php.net to get a copy of this message | ||
thank for reply me. But i think the problem is not in the .csv file because today when I test it
with netscape..it ok...
it return the message like that :
LOAD DATA LOCAL INFILE '/TEMP/phpB080AVGU' INTO TABLE
purchase FIELDS TERMINATED BY ','
(purchase_order,job_no,username,model,quantity,due_date,sent_date,courier_service,remark)
Successful.
but when I test with IE,it fail and return the message like that,
Error : LOAD DATA LOCAL INFILE 'C:\prchase3.csv' INTO TABLE
purchase FIELDS TERMINATED BY ','
(purchase_order,job_no,username,model,quantity,due_date,sent_date,courier_service,remark)
File 'c:purchase3.csv' not found (Errcode: 2)
the difererent is between the file reading by IE 5.5 and Netscape 4.7 there...seem like IE reading
file in C:\purchase3.csv and netscape reading file in /temp/phpB080AVGU ....
but the true path of file is locate in c:\purchase3.csv...why this will happen?
So I think the problem is occur on the variable $textfile that I defined...can some body help
me..thanks...
>Post a couple of lines from your data file. Does .csv insist on all
>values single quoted?
On Thu, Aug 16, 2001 at 09:03:36PM -0700, Yeong CN wrote:
> Hi.
> This is the script I write to upload a .csv file into my online mysql database :
>
> $sql_query="LOAD DATA LOCAL INFILE '$textfile' INTO TABLE purchase FIELDS
> TERMINATED BY ',' (purchase_order,job_no,username,model,quantity,due_date,sent_date,
> courier_service,remark)";
> $sql_query=($sql_query);
> $result=mysql_query($sql_query);
> $error_message=mysql_error();
> if(!$result)
> {
> echo"Error : $sql_query<br><p>";
> echo"$error_message";
> }
> else if($result)
> {
> echo"$sql_query<br><p>";
> echo"successful";
> }
>
> When I try to run the script in localhost, it is work.But when I try in the \
> server,it can't work and return the error message like that :
> Error : LOAD DATA LOCAL INFILE 'C:\\purchase3.csv' INTO TABLE purchase FIELDS \
> TERMINATED BY ',' (purchase_order,job_no,username,model,quantity,due_date,sent_date,
> courier_service,remark)
> File 'C:\purchase3.csv' not found (Errcode: 2)
>
>
> I think it maybe the backsplashes that make the error occur..
>
> so I change the script like that :
>
> $sql_query=stripslashes($sql_query);
>
> But it still return the error message like that :
>
> Error : LOAD DATA LOCAL INFILE 'C:\purchase3.csv' INTO TABLE purchase FIELDS
> TERMINATED BY ',' (purchase_order,job_no,username,model,quantity,due_date,sent_date,
> courier_service,remark)
> File 'C:purchase3.csv' not found (Errcode: 2)
>
>
> What happen actually...hope that somebody can help me. Thanks.
Get 250 color business cards for FREE!
http://businesscards.lycos.com/vp/fastpath/