Is there are script that can do this?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • m0307
    Confirmed User
    • Mar 2006
    • 221

    #1

    Is there are script that can do this?

    I have currently been developing a website that requires an enormous amount of data to by inputed into a data base. I am currently manually exporting data from a notepad document into my database. This is taking up way too much time having to type everything.

    Is there a script out there that can export data from a notepad document into the websites database. My website is written in php. If there isn't a script that does this, is there anyone who could make one?
  • m0307
    Confirmed User
    • Mar 2006
    • 221

    #2
    Originally posted by m0307
    I have currently been developing a website that requires an enormous amount of data to by inputed into a data base. I am currently manually exporting data from a notepad document into my database. This is taking up way too much time having to type everything.

    Is there a script out there that can export data from a notepad document into the websites database. My website is written in php. If there isn't a script that does this, is there anyone who could make one?

    bump....is phpmyadmin the best way to go?

    Comment

    • spacedog
      Yes that IS me. Bitch.
      • Nov 2001
      • 14149

      #3
      There's a way, yes.. I'm not sure on the specifics, but if you ftp the notepad .txt to your server, you can via phpmyadmin import it into tables

      Comment

      • GrouchyAdmin
        Now choke yourself!
        • Apr 2006
        • 12085

        #4
        Depends on the format. If it's native SQL, or hand-edited CSV, sure, that's easy.

        If you just want to dump a whole blob into a table, it's easiest to do with a throwaway PHP script:
        Code:
        <?php
        mysql_connect($host, $user, $pass) or die("Can't connect to database.");
        mysql_select_db($dbname) or die("Can't select database.");
        $data=(is_file($filename) && is_readable($filename)) ? file_get_contents($filename) : die("Missing file.");
        // ... parse file ...  Let's assume you used a pipe as a delimiter, and data is good
        $data = explode("|", $data);
        while (list($key, $value, $...) = each($data)) {
            echo "Key: $key; Value: $value<br />\n";
        }
        ?>
        ...obviously, parsing it and doing the mysql_insert in the loop is up to you. ;)

        Comment

        • GrouchyAdmin
          Now choke yourself!
          • Apr 2006
          • 12085

          #5
          To append to the above (edit timer ran out): I could likely make what you need if you could tell me what you want, or offered a dbschema (what you're dumping, where). Depending on complexibility, most of the work is already done above.

          Comment

          • darksoul
            Confirmed User
            • Apr 2002
            • 4997

            #6
            Originally posted by GrouchyAdmin
            Depends on the format. If it's native SQL, or hand-edited CSV, sure, that's easy.

            If you just want to dump a whole blob into a table, it's easiest to do with a throwaway PHP script:
            ...obviously, parsing it and doing the mysql_insert in the loop is up to you. ;)
            You don't need a script to import a csv file.
            1337 5y54|)m1n: 157717888
            BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
            Cambooth

            Comment

            • GrouchyAdmin
              Now choke yourself!
              • Apr 2006
              • 12085

              #7
              Originally posted by darksoul
              You don't need a script to import a csv file.
              You have console access.. and most users don't have the ability to turn on load file support, assuming, of course, this is applicable. However, yes, if you're doing CSV, phpMyAdmin would be the easy choice. ;)

              Comment

              Working...