October 23rd, 2000, 12:31 PM
Using the following code in PHP results in no data being loaded from a 1316 records .csv file:
$query = "load data infile '/path/file.csv' into table tablename fields terminated by ';' optionally enclosed by '"' lines terminated by 'rn' ignore 1 lines";
$rc = mysql_query($query);
Executing the same statement via telnet in mysql does load all data.
Can anybody tell me what's wrong?
This a recurring event which has to be done on a timed base (in this case I do it every time somebody is going to look into the data), but it could also be done by a 10 minute time-trigger.
Thank in advance for your help
October 23rd, 2000, 12:51 PM
Why don't use a shell script then ?
if u put in in php, u still have to exec
the php file
October 24th, 2000, 12:42 AM
Thanks so far Lewi,
It a workaround, but I don't know much about shell-scripts, that's something I will try to sort out. In PHP was an easy solution, because I put it in the script that also manipulates the data. The trick is that every 10 minutes new data is sent to the server and this data should be going into the database. The idea was to do the two things in one script, because the data will probably not be retrieved every ten minutes, so I skip the updates when they're not needed.
Anyway, you didn't see anything wrong in the load into part?
October 24th, 2000, 08:20 AM
You probably need to change the permissions on the file to nobody.
October 24th, 2000, 09:20 AM
Sorry Rod, could you please explain? CHMOD 000? And thanks for reacting so far.
October 24th, 2000, 09:34 AM
Sorry, I meant change owner.
October 25th, 2000, 05:01 AM
Thanks again Rod,
But that didn't solve the problem. Still doesn't work.