Re: Using MySQL Command Load Data Infile
From: Chris Hope (blackhole_at_electrictoolbox.com)
Date: 06/28/04
- Next message: Blah: "Re: MySQL Load with PHP"
- Previous message: Thad Rizzi: "Re: PHP and iSeries"
- In reply to: Bruce A. Julseth: "Using MySQL Command Load Data Infile"
- Next in thread: Bruce A. Julseth: "Re: Using MySQL Command Load Data Infile"
- Reply: Bruce A. Julseth: "Re: Using MySQL Command Load Data Infile"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 28 Jun 2004 15:53:38 +1200
Bruce A. Julseth wrote:
> When I execute this SQL statement in my PHP code, I get an error
> "File '.\Address.txt' not found (Errcode: 2)"
>
> $File = addslashes(".\Address.txt");
> $SQL = "Load Data InFile \"" . $File . "\" into table addresses";
> $result = mysql_query($SQL) or die(mysql_error());
>
> The file is located in the same directory as my .PHP file.
>
> How do I generate a relative address for this file so that it can be
> found? I'm running on XP Prof..
I suspect MySQL requires a full pathname to the file, because you're running
a SQL command. Although the file is relative to the PHP script MySQL has no
conception of that relative path. Try it with a full pathname and you
should be fine.
If it was a Unix/Linux box you'd need to make sure the MySQL server has
permissions to read from that directory and file, but you probably won't
have this problem on Windows.
-- Chris Hope - The Electric Toolbox - http://www.electrictoolbox.com/
- Next message: Blah: "Re: MySQL Load with PHP"
- Previous message: Thad Rizzi: "Re: PHP and iSeries"
- In reply to: Bruce A. Julseth: "Using MySQL Command Load Data Infile"
- Next in thread: Bruce A. Julseth: "Re: Using MySQL Command Load Data Infile"
- Reply: Bruce A. Julseth: "Re: Using MySQL Command Load Data Infile"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|