SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've got a mySQL dB and I'm trying to use the "INSERT TEXTFILE" feature to upload a *.txt file to the dB. It worked before I had win2000, and now it says:


    "MySQL said: The file '/tmp/phpWWHpW9' must be in the database directory or be readable by all"


    i've set the directory's permissions to: share and set the controls to full access.


    but i still get the same error!


    PLEASE HELP! I CANNOT GET PAID TILL THIS WORKS!


    thanks for any help in advance!!!


    Regards,

    Sam

  2. #2
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i've researched all over and still can't get an answer.

    I NEED HELP! PLEASE!

  3. #3
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A couple of things. The first thing that pops into my little cat brain is that you are uploading a text file and then just simply trying to use it in MySQL. This:

    Code:
    /tmp/phpWWHpW9
    is a temp name that PHP gives to your uploaded file. You must use PHP's copy() function copy that temp file to a normal file somewhere on your server. Let's say your form input is named userfile

    Code:
    <input type="file" name="userfile">
    After form submission you need to run something like
    PHP Code:
    $uploadsdir "/usr/john/uploads";
    copy($userfile$uploadsdir."/".$userfile_name); 
    Now you can call the text file in your mysql query.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  4. #4
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sure, if i programmed the phpAdmin myself I would do that, but i didn't and it has to do with a couple of things (this is my theory):

    I probably don't have the right permissions set for the dir. or something because i'm using win2000 now and it worked before the install.

    that's my only theory thus far, but i don't know what to do...i've changed permissions...and nothing.


    sam

  5. #5
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know that of the masterminds that frequent this site there has to be one that knows the answer to my problem!


    PLEAZZZZZZZZZE.


    i'm dieing here, i'm only on spring break for a couple of days left and I need to finish this fast!


    sam

  6. #6
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well if you want to know how a mastermind would do it, I am sure he would upload the textfile using ftp to his server and then ssh in to his server and use mysql from the command line on the server and run the INSERT TEXTFILE command from there. I am no mastermind but that is what I would do.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  7. #7
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dude if it was your cat that whispered that into your ear, you're cat's the bomb! I'll try that...only thing is that I hope the ssh client that i have works with w2k.


    sam

  8. #8
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pretty sure putty is a nice free one. I use SecureCRT but itisn't free. Yep Freddy told me about that one in January!
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  9. #9
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'm using putty, (works), but i'm trying to type in mysqladmin in the command line, but it isn't recognizing the command. is it possible that the isp isn't allowing this? (i use jumpline.com)


    thanks,

    sam

  10. #10
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I checked and even the lowest package has support for ssh.

    You should be typing mysql not mysqladmin that is why you are having a problem. Go from there and see how it goes.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  11. #11
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    great! it's actually working the way you said, but the only thing is it's tripping on itself because the file is delimited using commas, and i don't know how to specify this.


    please help!


    thanks,

    Sam

  12. #12
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you please provide a sample line from the textfile?
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  13. #13
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Stickem,john,800840001,800840064,DM,20010401,1,460611234,PHA,127

    i can enter this information using INSERT INTO member VALUES(....

    but i'm trying to load about 1,200 members into this table using a comma delimited file. there is a function called load data, but i don't understand the syntax either.


    thanks for all of your help!


    Sam

  14. #14
    ********* Addict DLG_1's Avatar
    Join Date
    Jun 2000
    Location
    Texas, USA
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the error that i'm getting is column count doesn't match value count in row 1.

  15. #15
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are probably better ways to accomplish this but the easiest way to do it would be something like this(ie, not using the LOAD INFILE)


    PHP Code:
    $file file("textfile");
    $count 1;
    foreach(
    $file as $key => $tmp) {
    $data explode(",",  $tmp);
    $result mysql_query("INSERT INTO tablename set field1 = '$data[0]', field2 = '$data[1]', field3 = '$data[2]', field4 = '$data[3]', field5 = '$data[4]', field6 = '$data[5]'");
    if(
    mysql_affected_rows($result) > 0) print "Row $count inserted okay<br>";
    $count++;

    Please don't PM me with questions.
    Use the forums, that is what they are here for.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •