Jump to content


Photo

having problem with "LOAD_FILE("...")" c


  • Please log in to reply
3 replies to this topic

#1 wraith

wraith
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 09 April 2003 - 07:50 AM

The problem is as follows :

How to get the LOAD_FILE() command to work in a .php script?

I have tested the command itself in mySQL and it works fine. (I am trying to import a .txt file into one field of a table)
I have used the command as follows :

INSERT INTO common VALUES
(1, 1, LOAD_FILE(\"e:\\1.txt\"), NULL, \'N\');
and it worked the way i wanted it - so there can\'t be any problems with the database itself.

Then I tried to use the same command in a php script :

$address = \"e:\\\\1.txt\";
$load_file = \"INSERT INTO common VALUES
(\'$row[$x]\',$user\',LOAD_FILE(\"$address\"),\'NULL\',\'N\')\";
$result = mysql_query($load_file);

then the page containing the script reloads for quite a long time, and when I check mySQL what actually happened I get the output :

1,1,NULL,NULL,N

WHAT\'S WRONG WITH THE SCRIPT???
the command in mySQL imports the data correctly, the script fails to do so.
HEEEEEELP!!!!

#2 wraith

wraith
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 09 April 2003 - 08:40 AM

Okay ... the thing seems to work now.

The problem seems to be too long file names!

I was using names like \"keywords_182398741.txt\"
when I changed the name to \"1.txt\" it worked all right!




Is there any limit to how long a file name can be (for mySQL to handle) ?
wraith

#3 wraith

wraith
  • Members
  • Pip
  • Newbie
  • 4 posts

Posted 09 April 2003 - 09:11 AM

It seems that the length of the files doesn\'t create any problems...
it\'s the \"_\" in the filename that crashed the whole thing.



PS.
could some1 pls reply? I\'m feeling like a loony posting re\'s to my own letter!

#4 DocSeuss

DocSeuss
  • Members
  • PipPipPip
  • Advanced Member
  • 73 posts
  • LocationTexas, USA

Posted 09 April 2003 - 10:10 AM

Seemed like you fix your problem, and maybe educated someone who may run accross the same one. Good Job.
"Unlimited budget? Great, for $5,000,0000 we will run your ad banner for one year"  ----Rasmus Lerdorf




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users