Jump to content


Photo

Query works from shell but not PHP page


  • Please log in to reply
3 replies to this topic

#1 daverose

daverose
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 08 May 2003 - 06:34 PM

Hi,

I have a query that I\'m attempting to load from a PHP page that is not working. However, the exact same query works just fine when I run it from the MySQL command line.

This is the query:
LOAD DATA LOCAL INFILE \'/home/ratdog/public_html/test.txt\' INTO TABLE `shows`

I\'ve run similar queries through PHP with no problem, and I\'m absolutely stumped on why this won\'t work when it works fine from the command line.

Thanks for any help,

Dave

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 09 May 2003 - 12:11 AM

a. does the webserver have access to that directory/file?
b. are you connecting to the db with a use that has the permission to run the query?
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 daverose

daverose
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 May 2003 - 12:14 PM

Yes. I can run that same query that imports the data from that same file if I type it at the command line. Nothing happens from PHP though. (The same PHP script has other queries of the database, and those work properly.)

Thanks.

#4 daverose

daverose
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 09 May 2003 - 04:00 PM

By the way, I get the error:

ERROR: The used command is not allowed with this MySQL version

if I make it `shows` instead of \'shows\'



I get the error:

ERROR: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near \'\'shows\'\' at line 1

if I leave it as \'shows\'




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users