This code reads the database and prints out the news onto the homepage.
Now, I had this 100% working with IPS Forum,
I went in and updated the code to read the vbulletin4 datavase and it's showing no recent news when I load the phone file as there is nothing in the database but I'm almost certain everything is correct also have no errors either in the error log or via php
I'm also shite with php and SQL too so.
Left out the SQL connecty bit just the main code is posted
Code:
$forum_id = 2;
$limit = 3;
$mysqli -> set_charset("utf8mb4");
$request = $mysqli -> query ("
SELECT * FROM
`forum` as `ft`
LEFT JOIN
`post` as `fp`
ON
`fp`.`threadid` = `ft`.`tid`
WHERE
`ft`.`forumid` = $forum_id
ORDER BY
`ft`.`tid` DESC
LIMIT
$limit
");
if($request -> num_rows > 0)
{
while($row = $request -> fetch_array(MYSQLI_BOTH))
{
$post_clean = preg_replace('/[ \t]+/', ' ', preg_replace('/\s*$^\s*/m', "\n", strip_tags($row['posttext'])));
$post_convert = strtr($post_clean, array_flip(get_html_translation_table(HTML_ENTITIES, ENT_QUOTES)));
$post = trim($post_convert, chr(0xC2).chr(0xA0));
$start_date = time_elapsed_string(date("D, d M Y H:i:s", $row['start_date']));
$topic_link = "//forum.vitalityx.org/showthread.php?".$row['tid'];
echo '
<dt><span class="newsdate">'.$start_date.'</span>'.$row["title"].'</dt>
<dd>
<table width="100%"><tr>
<td style="text-align: justify; vertical-align: top;">'.$post.'</td>
<td style="padding-left: 1em; text-align: right; vertical-align: top;">
<img width="50" height="50" src="img/news/shop_2.gif">
</td></tr></table>
<div style="margin-top: 0.5em;"><a href="'.$topic_link.'">Read more...</a></div>
';
}
} else {
echo '
<div class="news">
No recent news!
</div>
';
}
^