• Resolved silencematters

    (@silencematters)


    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!
    -jeremy

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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:
    <?php
    // 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");
    ...

    Thread Starter silencematters

    (@silencematters)

    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!
    -jeremy

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘pulling data from a separate mysql database within WP’ is closed to new replies.