Re: mySQL LOAD DATA INFILE
| From: | Russ Michell | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | Re: mySQL LOAD DATA INFILE | ||
| References: | 1 | Groups: | php.db php.general |
| Request: | Send a blank email to php-general+get-73591@lists.php.net to get a copy of this message | ||
2 things:
> mysql_query($QueryInsert);
> print mysql_error();
Should read:
$query = mysql_query($QueryInsert) or die(mysql_error());
and:
>> It returns "Can't get stat of '/www/publico2/tableData0TMRRy' (Errcode:
>> 13)".
what exactly is: "tableData0TMRRy"?? if it should be a file, it should be called
'myfile.txt' (with
a file suffix)
HTH
Russ
On Tue, 6 Nov 2001 14:56:00 +0200 =?iso-8859-1?Q?Niklas_Lamp=E9n?= <niklas.lampen@publico.fi>
wrote:
> I have this code:
>
> <?
> $dir = getcwd();
>
> $fpName = tempnam($dir, "tableData");
> $fp = fopen($fpName, "w");
> fputs($fp, $strData);
> fclose($fp);
>
> $QueryInsert = "
> LOAD DATA INFILE '$fpName'
> INTO TABLE feStatics
> FIELDS TERMINATED BY '|'
> LINES TERMINATED BY '\n'
> ";
>
> mysql_query($QueryInsert);
> print mysql_error();
>
> unlink($fpName);
> ?>
>
> It returns "Can't get stat of '/www/publico2/tableData0TMRRy' (Errcode:
> 13)".
>
> I'd put this file into mySQL's database dir, but I have no access there.
> Any ideas how to do this? Inserting file row by row would take like
> eternity, so that is not a good idea.
>
>
> Niklas
#-------------------------------------------------------#
"Believe nothing - consider everything"
Russ Michell
Anglia Polytechnic University Webteam
Room 1C 'The Eastings' East Road, Cambridge
e: r.j.michell@apu.ac.uk
w: www.apu.ac.uk/webteam
www.theruss.com
#-------------------------------------------------------#