WordPress.org

Ready to get started?Download WordPress

Forums

Pulling database info in wordpress (1 post)

  1. just wondering
    Member
    Posted 3 years ago #

    I've tried to pull info in from another database but can not do it.

    I can't figure out what's wrong. I created another page in another folder with regular html headers and footers and it works like a dream.

    Put it in wordpress index.php or sidebar and I get nothing. As a note if I get the path wrong I get an error message.

    Hear is the code I want to use, very simple

    include ('../../../connect.php'); // Connect to database
    $q = "SELECT * FROM ou_info_source ORDER BY date_pub DESC LIMIT 0, 5";
    $r2 = mysqli_query ($dbc, $q); // Run the query
    if ($r2) { //If $r2 ran OK display
    echo '<table>
    <tr><td><h4>Links</h4></td></tr>';
    while ($row = mysqli_fetch_array($r2, MYSQLI_ASSOC)){
    echo '<tr><td><p>'.$row['link_source_title'].'</p></td></tr>
    ';
    }
    echo '</table>'; //close table

    Thanks for your help.
    S

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by just wondering
  • This topic is not resolved
  • WordPress version: 3.0.1