PDA

View Full Version : Help Converting This Code


Black Snow
01-31-2013, 09:27 PM
Hi,

I have some code from my friend's forum, I am unsure why it won't work for my forum and I guess it's because this could be for vB 3 and I run 4.2.0.

$siteposts = $db->query_read("
SELECT thread.lastposter, thread.lastpost, thread.views, thread.open, thread.forumid, thread.replycount, thread.threadid, thread.pollid, thread.title, user.username, user.userid, user.usergroupid, IF(displaygroupid=0, user.usergroupid, displaygroupid) AS displaygroupid FROM " . TABLE_PREFIX . "thread as thread
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.username = thread.lastposter) WHERE forumid NOT IN (30, 3, 13, 15, 34, 16, 31, 81, 82, 17, 18, 19, 20, 22, 80, 79, 21, 69, 70, 71, 72, 73, 24, 25, 32, 85, 84, 86, 87) ORDER BY lastpost DESC LIMIT 0, 19");
while($latest = $db->fetch_array($siteposts))
{

$latest['title'] = str_replace($hidechar, " ", $latest['title']);

if (strlen($latest['title']) > 29)
{
$latest['title'] = substr($latest['title'], 0, 29) . '...';
}
else
{
$latest['title'] = $latest['title'];
}

$latest['title'] = htmlspecialchars($latest['title']);
$trans = array("&" => "&");
$latest['title'] = strtr($latest['title'], $trans);
$latest['replycount'] = number_format($latest['replycount']);
$lastest[musername] = fetch_musername($latest);
$lastest[musername] = $db->escape_string($lastest['musername']);
$date = date("g:i a",$latest['lastpost']);
$div = '<div style="border-bottom: 1px dotted #5080a6; padding: 2px;">';
$enddiv = '</div>';
$ci = '<img src="http://.png"; alt="" class="inlineimg">';

$latest_downloads .= "
$div
<div style='font-size: 11px;'><font color='#ce6262'>&bull;</font> <a href='showthread.php?t=$latest[threadid]' title='$latest[title]' style='font-size: 10px;'><b>$latest[title]</b></a></div>
<div style='padding-top: 1px; padding-bottom: 1px;'><a href='member.php?u=$latest[userid]' style='font-size: 9px;'>Posted by $latest[musername]</a></div>
<div style='padding-top: 1px; padding-bottom: 2px; font-size: 7pt;'>
<span>$ci <font color='#8A478F'><b>$latest[replycount] Comments</b></font></span>
$enddiv
</div>";

Thanks.

kh99
02-01-2013, 01:03 PM
I don't see anything in that that's version-specific, and there's not enough context to know why it doesn't work (I didn't inspect it for bugs, but since you said it works on your friend's site I'm assuming that's not the problem).