Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
February 20, 2005, 1:37 am
rate this thread
I'm building an e-commerce site, where the owner needs to be able to
upload a CSV file of product that gets inserted into mySQL.
Unfortunately, I think my Web host may have some functions turned off.
Is there some other ways I can try to do the following?
First, I'm using a form to upload a file. That works, but it sets the
file permissions to 600, and the PHP command "exec()" is disabled so I
can't chmod it as part of the script.
But that's OK I guess. I can still FTP the file up and change the
permissions to even 777 if need be. The real problem comes when trying
to do the insert:
$sql = "LOAD DATA INFILE
'/home/myaccount/public_html/data/item_test.csv' INTO TABLE
`tbl_temp_produpload` FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES
TERMINATED BY '\r\n'";
$result = @mysql_query($sql, $dbh) or $error_msg .= "<div
I'm getting no error message, but it's not inserting either.
I can use phpMyAdmin to manually insert the file off my local PC, but I
just can't get it to do it from the file on the server.
Is there another way to do this? (No I can't give phpMyAdmin access to
Thanks for any suggestions!
Re: need help inserting a CSV into mySQL via PHP page.
Daniel Tryba wrote:
Huh. Lookeedere. Had no idea. Thanks!
OK, well, I still have the most important problem of not being able to
use the mySQL command: "LOAD DATA INFILE".
Any workarounds or tips on that?