'LOAD DATA INFILE' clarification, path for the file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mih
Forum Newbie
Posts: 12
Joined: Tue Jul 28, 2009 12:32 am

'LOAD DATA INFILE' clarification, path for the file

Post by mih »

Hello,

Just trying to learn how this statement works.

I use a file on my machine and want to load into a db on my machine as well.

In the php I put the path to the file

Code: Select all

'c:\wamp\www\tests\file.txt'
and the error is 'Query was empty'.

I load the file using phpadmin and no error and in the generated php code the path is

Code: Select all

'c:/wamp/tmp\\php11.tmp'
Why's that ? I'm puzzled.
How shall I make it work ?

Thank you
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: 'LOAD DATA INFILE' clarification, path for the file

Post by Christopher »

You might want to try forward slashes:

LOAD DATA INFILE 'c:/wamp/www/tests/file.txt' INTO TABLE mytable;
(#10850)
mih
Forum Newbie
Posts: 12
Joined: Tue Jul 28, 2009 12:32 am

Re: 'LOAD DATA INFILE' clarification, path for the file

Post by mih »

Thank you Christopher.

This was the solution. I was under the impression that this path is for Linux and for Windows is with '\' as in the 'Properties' of the file for the Location.
Post Reply