Code: Select all
<?
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$dbhost = "localhost";
$dbuser ="User";
$dbpass = "PassWord";
$database = "database";
$ibf_prefix = "prefix_";
$db = mysql_connect($dbhost, $dbuser, $dbpass) or die ("Could not connect to database");
mysql_select_db ($database, $db) or die("Unable to select database!");
function iif($expression, $returntrue, $returnfalse="")
{
if ($expression)
{
return $returntrue;
}
else
{
return $returnfalse;
}
}
$recentforumget = "10"; // Number of posts to get
$forumexclude = "1,2,3,4,5"; // Add forum id's to exclude from get (eg private ones) separate by a
$forumpath = "http://www.mydomain.com/forum";
$getposts = mysql_query("SELECT
tid,
title,
forum_id,
starter_id,
starter_name,
last_poster_id,
last_poster_name,
last_post
FROM ".$ibf_prefix."topics
WHERE (state = 'open')".iif($forumexclude," AND (forum_id NOT IN ($forumexclude))")."
ORDER BY last_post DESC
LIMIT $recentforumget") or die (mysql_errno().": ".mysql_error()."<br />");
echo "<table width="100%">";
echo "<tr>";
echo "<td>Topic</td>";
echo "<td>Creator</td>";
echo "<td>Last post by</td>";
echo "<td>Date</td>";
echo "</tr>";
while ($post = mysql_fetch_array($getposts))
{
$post[last_post] = date("m-d-Y @ h:i A",$post[last_post]-$timeoffset);
echo "<tr>";
echo "<td>";
echo "<a href="".$forumpath."/index.php?act=ST&f=";
echo "".$post['forum_id']."&t=";
echo "".$post['tid']."&view=getlastpost">";
echo "".$post['title']."</a></td>";
echo "</td>";
//Starter
echo "<td>";
echo "<a href="".$forumpath."/index.php?showuser=".$post['starter_id']."">".$post['starter_name']."</a>";
echo "</td>";
//Last Poster
echo "<td>";
echo "<a href="".$forumpath."/index.php?showuser=".$post['last_poster_id']."">";
echo "".$post['last_poster_name']."</a>";
echo "</td>";
//Date of last post
echo "<td>".$post['last_post']."</td>";
echo "</tr>";
}
echo "</table>";
?>
<? mysql_close($db); ?>What is it I'm doing wrong ?Fatal error: Call to a member function on a non-object in /home/usr/public_html/components/com_banners/banners.php on line 34
Thanks in advance