1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Make text files from database

Discussion in 'Blogging' started by matt89, Sep 12, 2011.

  1. matt89

    matt89 Registered Member

    Joined:
    Feb 4, 2011
    Messages:
    64
    Likes Received:
    4
    Hi

    I have a wordpress database. I already extracted some information from the database, so it looks like:

    Post title,Post content
    "Hello world","Hi my name is Matt"

    Is there possibility to transfer each of the database line into a single text file?
    Where text file name is Post title.
    I would like to archive some of my articles.
     
  2. Orbit143

    Orbit143 Senior Member

    Joined:
    Aug 8, 2010
    Messages:
    893
    Likes Received:
    588
    Location:
    /home
    SELECT `post_content`, `post_title` FROM `wp_posts`;

    This query will return and array of all posts and their titles. Then you can do whatever you want with it, eg. use fwrite() to write it into separate files.
     
    • Thanks Thanks x 1