MyBB Community Forums

Full Version: Getting message data from mysql
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all
I have a torrent tracker and i want to use overlib to show message in my tracker from forum i have this at the moment

print("<table width=\"100%\" cellpadding=\"2\" cellspacing=\"0\"><tr><td align=\"center\" class=\"colhead\">Topic</td><td align=\"center\" class=\"colhead\">Author</td><td align=\"center\" class=\"colhead\">Viewed</td><td align=\"center\" class=\"colhead\">Posts</td><td align=\"center\" class=\"colhead\">Last msg</td></tr>");
$topics = mysql_query("SELECT * FROM ".TABLE_PREFIX."threads WHERE visible = 1 ORDER BY lastpost DESC LIMIT 5");
while ($topic = mysql_fetch_array($topics)) {
	$topic_id = $topic["tid"];
	$forum_id = $topic["fid"];
	$topic_subject = $topic["subject"];
	$topic_starter_uid = $topic["uid"];
	$topic_starter_name = $topic["username"];
	$topic_started = $topic["dateline"];
	$topic_firstpost = $topic["firstpost"];
	$lastpost = $topic["lastpost"];
	$lastposter = $topic["lastposter"];
	$lastposter_uid = $topic["lastposteruid"];
	$topic_views = $topic["views"];
	$topic_replies = $topic["replies"];
	print("<tr><td><a href=\"forums.php?showthread=$topic_id\" onmouseover=\"return overlib('<table width=100%><tr><td>$message</td></tr></table>',  WIDTH, 350, DELAY, 200);\" onmouseout=\"return nd();\";>$topic_subject</a></td><td align=\"center\"><a href=\"forum/member.php?action=profile&uid=$topic_starter_uid\" title=\"".get_date_time($topic_started)."\">$topic_starter_name</a></td><td align=\"center\">$topic_views</td><td align=\"center\">$topic_replies</td><td align=\"center\"><a href=\"forum/showthread.php?action=lastpost&tid=$topic_id\" title=\"".get_date_time($lastpost)."\">$lastposter</a></td></tr>");

	}
So i want help to figure out how to make it get data from message from mybb_posts
Somethin like
$message = mysql_query("SELECT * FROM ".TABLE_PREFIX."posts");
I need help.
Thank you all
$query = $db->query("SELECT message FROM ".TABLE_PREFIX."posts");
while($post = $db->fetch_array($query))
{
    $message = $post['message'];
    echo $message;
}

Something like this
Yes it works!Thanks!