1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Need An Expert On This One: Migrating A MySQL Database Into Wordpress

Discussion in 'MySQL' started by bertamus11, Jun 28, 2008.

  1. #1
    For the life of me I cannot figure this one out. I need some help.
    I need to get my database into wordpress.

    I found this but really have no idea what to do next:
    "
    For the past year I have been running a site with articles that I manually insert into the backend using Phpmyadmin and retreive using mysql and php.

    Now I want to run my site with WP becuase of features such as commenting but can't figure out how to copy my exsisting articles in the database to WP's database. There are 100s of them.

    I have searched this forum but most migration related threads are to do with CMS run sites (like jomla and drupal) to WP whereas I was inserting my text by going to the backend.

    Any suggestions?
    -----------------------------------------
    Take a look at the mysql tables that wordpress uses for storing its posts, comments, users, etc.

    Then take a look at your existing database. All you'll have to do is write a script to retrieve values from your db and output them to a file as sql statements for the target (wordpress) db.

    It should be pretty straightforward. If you can describe your current database schema, it would help.
    --------------------------------
    That's good to hear. I would appreciate it greatly if you give me the basic skeleton and explain how to "output them to a file as sql statements for the target (wordpress) db".

    Info you might need:
    Database name: sportsArticles

    Table Name: footballtbl
    Fields: ID (int, autoincriment, key), Title (varchar) , Author (varchar), fullText (longtext), previewText (tinytext), date), Qoute (varchar).

    other tables exsist in similar fashion for rugby and athletics.

    Note: Date is in this format (date (yyyy, mm, dd)
    --------------------------------------------------------
    http://codex.wordpress.org/Database_Description

    This document explains the wordpress db structure.

    You can use phpMyAdmin to export your existing database into a text file with SQL statements.

    Next, write a parser (regular expression matcher) to go through each sql statement and transform it to the wordpress format.

    Later, import this sql file from phpMyAdmin.

    (Alternately, you could transform the sql statements into xml and import from your wordpress admin interface)
    "
    Anybody know how to do this? I could provide my database for you, etc. if you need it. It would be much appreciated. Thank you.
     
    bertamus11, Jun 28, 2008 IP
  2. Ulquiorra

    Ulquiorra Peon

    Messages:
    422
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Best thing to do would be write a small PHP script. Gimme a few minutes to figure the code out.

    Edit: Here's the code. Modify the DB names and passwords as required. I'm assuming both DBs are on localhost.

    You might wanna modify the red stuff!

    Might not be 100% working, haven't tested. Hopefully will work though.

    Could really be wrong on the date, I didn't get what you tried to say with your date formats. Also the bracket in the weird place.

    If it says it's in datetime format this should work.

    lol @ this is my 250th post.
     
    Ulquiorra, Jun 28, 2008 IP
  3. excelmtr

    excelmtr Banned

    Messages:
    114
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    if youre finding a way to Import a MySQL Databse into Wordpress, then i can help you easily
     
    excelmtr, Jun 28, 2008 IP
  4. Ulquiorra

    Ulquiorra Peon

    Messages:
    422
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #4
    He's trying to import a non-wordpress database, and that php is already up there.

    Edit: Usage instructions for OP: put that code in notepad, save as port.php, upload to your server, then visit it from your browser.
     
    Ulquiorra, Jun 28, 2008 IP
  5. bertamus11

    bertamus11 Well-Known Member

    Messages:
    791
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    130
    #5
    Thanks Ulquiorra! I will try that! I appreciate your help.
     
    bertamus11, Jun 28, 2008 IP
  6. Ulquiorra

    Ulquiorra Peon

    Messages:
    422
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #6
    PM me if you have issues with it.

    No prob :)
     
    Ulquiorra, Jun 28, 2008 IP
  7. dadaas

    dadaas Well-Known Member

    Messages:
    1,298
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    160
    #7
    hi,
    Its maybe old thread but its very important to me, because i think this code could actually work.

    Right now im in process of converting and i think it will be converted wrong, because my old category only have this contant:
    Category and Joke

    And in code i need:
    $id=mysql_result($result,$i,"ID");
    $title=mysql_result($result,$i,"Title");
    $author=mysql_result($result,$i,"Author");
    $content=mysql_result($result,$i,"fullText");
    $excerpt=mysql_result($result,$i,"previewText");
    $date=mysql_result($result,$i,"date");

    So how can i set up this?
    Can i put some querry to add this this automaticaly to my old database and then try to convert to WP?
    P.S. my WP database is already installed do i detelete it?
     
    dadaas, Mar 11, 2009 IP