Pulling database info in wordpress
-
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 tableThanks for your help.
S
- The topic ‘Pulling database info in wordpress’ is closed to new replies.