[resolved] pulling data from a separate mysql database within WP (3 posts)

  1. silencematters
    Posted 10 years ago #

    I have created a page on my site. Within that page, can i have an area that pulls data from a separate mysql database?

    I have some data that I want sortable in a table,.. and i have been asked to make ti sortable, but in order to diplay it on the site, it will need to be on a WP 'page.'

    I just wanted to know if this was possible, or if there were going to be complications with this.
    thank you!

  2. skippy
    Posted 10 years ago #

    Make a page template for this page, and in the template, include the necessary PHP code to connect to the other database, fetch the data, and then close the connection:
    // connect to the database
    $db = mysql_connect($dbhost, $dbuser, $dbpass) or die ("Could not connect: " . mysql_error());
    $dbselect = mysql_select_db($dbdatabase);
    if (! $dbselect) {
    die ("Unable to select $dbdatabase: " . mysql_error());
    $dbresult = mysql_query("SELECT foo FROM bar");

  3. silencematters
    Posted 10 years ago #

    Thank you! I am soo happy to hear that it is possible within WordPress, and that it wont interfere with the WP database at all.
    thanks again Skippy!

Topic Closed

This topic has been closed to new replies.

About this Topic