Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

load data infile

Status
Not open for further replies.

kehers

Programmer
Aug 31, 2005
56
A2
i'm trying to use the load data infile addin of mysql to load some text values to a table. unfortunaltety my verssion of mysql doesnt support it. As with all things, is there any other way to do this?
 
you may require the keyword local.

load data local infile '/path/to/file' into .....

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
What version of mysql are you running ?,

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
here exactly is how d statement went....
Code:
<?php
mysql_connect("localhost", $username, $password);
mysql_select_db("ng");
$sql = "load data local infile 'movies.txt' into table dir fields terminated by '|'";
if($res = mysql_query($sql))
echo "correct";
else 
echo mysql_error();
?>
the script and movies.txt are in the same directory. the mysql version is 4.0.22

 
you'll need the absolute path for the infile command to work.

you can use getcwd() for the path.

$sql="load data infile '".getcwd()."/movies.txt' into table dir fields terminated by '|'";


______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top