WordPress.org

Forums

Show external data as posts (2 posts)

  1. kurtbogdon
    Member
    Posted 2 years ago #

    Hello. I want to incorporate data from an external MySQL DB into wordpress. The reason is that the particular DB has roughly 10 million rows, and I don't want to overload the WP DB.

    I can display the data quite easily using $wpdb (for example, a list of titles, as if it were a category page).

    What I would like is that when clicking on any title, that the data can be pulled from the external DB and showed in the same was as a post, in a single page.

    I've tried for several days but no success.

    Has anyone had similar experience?

    Ken

  2. bcworkz
    Member
    Posted 2 years ago #

    I haven't actually done anything like that, so maybe I'm all wet, but I like to think I know something about it.

    I'm surprised you can access the data with $wpdb, it should only work on tables within the same database, though on any table, not just WP tables. If so, you should be able to get any data from the table besides titles.

    If it is indeed a separate DB, you can connect to it and use the usual php functions to interact with it and return the results in WP.

    Another idea that I think will work is to instantiate another wpdb object that's connected to the other data base, then you can use wpdb object methods to interact with the other DB.

Topic Closed

This topic has been closed to new replies.

About this Topic