Title: Inserting data from another database into posts
Last modified: August 19, 2016

---

# Inserting data from another database into posts

 *  [megler](https://wordpress.org/support/users/megler/)
 * (@megler)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/inserting-data-from-another-database-into-posts/)
 * I want to create a database of baseball stats that I’d like to use in my blog.
   the problem is, I am not sure how to call the data into the posts to display 
   it. Is there any reference on this? I have googled it a ton if different ways,
   but no luck. maybe not using the right search criteria.
 * Any help would be greatly appreciated.
 * Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)

 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/inserting-data-from-another-database-into-posts/#post-1299862)
 * If you actually want to use a different database than WP uses that could be tricky
   but it is relatively easy to insert from custom tables in the same database that
   WP uses. As far as getting it into your posts, how you’d do that depends on what
   you want to do. I can’t tell exactly what your plan is from your post. Are there
   custom meta tags associated with the posts? Or categories that are relevant? 
   Or tags that are relevant? Or are you thinking about using some kind of keyword
   in the post body to get the data?
 *  Thread Starter [megler](https://wordpress.org/support/users/megler/)
 * (@megler)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/inserting-data-from-another-database-into-posts/#post-1299872)
 * Thanks so much for getting back! It would be a clean WP install just for this
   database. The db is a large relational database of historic baseball stats (players,
   biographical data, stats, etc).
 * What I’d like to do is use that database to create a blog where say each post
   is about a single player. Just not sure how to implement it, or if it’s even 
   practical.
 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/inserting-data-from-another-database-into-posts/#post-1299944)
 * Are you saying that you’d be pulling data from the ‘baseball stats’ database,
   using that data to create posts in a WP database, then after that not using the‘
   baseball stats’ database anymore?
 *  Thread Starter [megler](https://wordpress.org/support/users/megler/)
 * (@megler)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/inserting-data-from-another-database-into-posts/#post-1300034)
 * that would be correct. the entire blog would be populated from the baseball stats
   database. no further updates to the blog would be made past that point. I’m using
   WP as a form of CMS for this vs a blog.
 *  [s_ha_dum](https://wordpress.org/support/users/apljdi/)
 * (@apljdi)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/inserting-data-from-another-database-into-posts/#post-1300053)
 * Oh… well that’s a much easier project than I originally thought. Really, all 
   you’ve got to do is get both databases running on the same server– easy if they
   are both MySQL–, query your stats database, and loop through the results, each
   iteration building an array of post values which are fed to wp_update_post. If
   you build the script inside a minimal plugin you have easy access to WP functions.
   I’ve imported an MSSql database this way, except that the new WP server didn’t
   run MSSql so I had to go from MSSql to CSV to a temporary MySql table first, 
   then loop through. What kind of database are you starting with?
 *  Thread Starter [megler](https://wordpress.org/support/users/megler/)
 * (@megler)
 * [16 years, 6 months ago](https://wordpress.org/support/topic/inserting-data-from-another-database-into-posts/#post-1300060)
 * it’s a mysql database, so at least there’s compatability. 🙂
 * good thing I’m learning php/mysql now. I know what you’re telling me to do, but
   have no clue how to do it. <back to studying reference books..>
 *  [salte](https://wordpress.org/support/users/salte/)
 * (@salte)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/inserting-data-from-another-database-into-posts/#post-1300167)
 * Hi
 * I’m quit new to WP myself, and are haveing more or less the same problem. I run
   a soccer supporter site, and we have a MySql site containing stats of the players
   and games played back from 1976 up to today.
 * I’m very interesting in any feedback you have done on this and if there is a 
   possible solution that I could use, that would be great!!
 * Regards
    Atle

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Inserting data from another database into posts’ is closed to new replies.

## Tags

 * [dynamic data](https://wordpress.org/support/topic-tag/dynamic-data/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 3 participants
 * Last reply from: [salte](https://wordpress.org/support/users/salte/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/inserting-data-from-another-database-into-posts/#post-1300167)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
