news@celticbear.com wrote:[color=blue]
> 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
> align=\"center\" class=\"tah12RedBold\">".mysql_error()."</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
> the user.)
>
> Thanks for any suggestions!
> Liam
>[/color]
Why use PHP? mysqlimport (included with MySQL) can handle that for you.
NM
--
convert UPPERCASE NUMBER to a numeral to reply