MyBB Community Forums

Full Version: Last 5 topics problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here is the code
print("<table width=737 class=main border=0 cellspacing=0 cellpadding=0><tr><td align=\"center\" class=\"colhead\">Тема</td><td align=\"center\" class=\"colhead\">Автор</td><td align=\"center\" class=\"colhead\">Видяна</td><td align=\"center\" class=\"colhead\">Отговори</td><td align=\"center\" class=\"colhead\">Посл. съобщение</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\">$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>");
}

print("</table>");

print("Форум <font size=\"-2\"> - [<a class=\"altlink\" href=\"forum/search.php?action=getnew\">New posts</a>]</font> <font size=\"-2\">[<a class=\"altlink\" href=\"forum/search.php?action=getdaily\">Daily Posts</a>]</font>");
But the problem is that shows these kind of symbols
Версия 
You have to make sure you're using the right character sets for things.

You should send the character set being used in your script using a Content-encoding header.
Can u give an example?
try to use mybb's db functions instead of mysql's

for query : $topics = $db->query("");
for fetch : while ($topic = $db->fetch_array($topics))