Announcement

Collapse
No announcement yet.

conversion from flat database to mysql

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • conversion from flat database to mysql

    how can i convert data that stored in flat database to mysql?

  • #2
    You can read the file, store its contents to a variable, explode it, and list the array to add the info to the database.
    Chen Avinadav
    Better to remain silent and be thought a fool than to speak out and remove all doubt.

    גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

    Comment


    • #3
      Thought I could be a little bit more specific.

      Let's say, that in the flat files, the data is seperated using three pipes, i.e |||.
      For this example, the file name would be email.dat, and it will contain a list of e-mails, each seperated by |||:
      So, the file will look like this:
      PHP Code:
      <?php
      error_reporting
      (7);
      require(
      "./global.php");

      // Path to the data file
      $path="./email.dat";

      // Get the site of the file
      $filesize=filesize($path);

      // Open file, read its data into $allemails and close it
      $filenum=fopen($path,"r");
      $allemails=fread($filenum,$filesize);
      fclose($filenum);

      // Making an array out of the file data, separating each email with a ||| sign
      $emailbits=explode("|||",$allemails);

      // Listing the array inside a loop, adding it to the database and echo about it.
      while (list($key,$curemail)=each($emailbits);
        
      $DB_site->query("INSERT INTO email (emailid,address) VALUES (NULL,'".addslashes($curemail)."')");
        echo 
      "Added email: $curemail";
      }

      // All done, let's go home!
      echo "All e-mails imported successfully!";

      ?>
      (note: using vBulletin's global.php file for a function)

      I used a little version of the style installer of vBulletin.
      Chen Avinadav
      Better to remain silent and be thought a fool than to speak out and remove all doubt.

      גם אני מאוכזב מסיקור תחרות לתור מוטור של NRG הרשת ע"י מעריב

      Comment


      • #4
        phpMyAdmin has an easy to use feature. It's a link called 'Insert textfiles into table'
        Five Star Review Script - Add reviews to your website!
        Mixed Martial Arts - Houston MMA Training
        Women's Self-Defense - Courses and DVDs available

        Comment


        • #5
          how to use? i have phpmyadmin installed on my computer...but i didnt' see any link that says 'convert textfiles to tables'?

          Comment


          • #6
            Click 'Properties' for whatever database you want to insert the data into. From the properties page you'll see the link.

            Tim
            Five Star Review Script - Add reviews to your website!
            Mixed Martial Arts - Houston MMA Training
            Women's Self-Defense - Courses and DVDs available

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X