#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    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
    Rob
  2. #2
  3. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    6
    Rep Power
    0
    Why don't use a shell script then ?
    if u put in in php, u still have to exec
    the php file

    ------------------
    Greetings lewi
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    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?
    Thanks again,
    Rob
  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    You probably need to change the permissions on the file to nobody.
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    Sorry Rod, could you please explain? CHMOD 000? And thanks for reacting so far.
    Rob
  10. #6
  11. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    Sorry, I meant change owner.
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    Thanks again Rod,
    But that didn't solve the problem. Still doesn't work.
    Rob

Similar Threads

  1. Check MySQL Version thru PHP
    By wolftrap1 in forum PHP Development
    Replies: 2
    Last Post: February 11th, 2004, 09:51 PM
  2. Replies: 5
    Last Post: February 11th, 2004, 03:18 AM
  3. Replies: 0
    Last Post: February 11th, 2004, 12:44 AM
  4. Replies: 0
    Last Post: January 30th, 2004, 02:22 PM
  5. PHP 5 (MYSQL vs. SQLite)
    By ignition in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 01:13 PM

IMN logo majestic logo threadwatch logo seochat tools logo