chriscara
03-10-2007, 10:28 PM
Hi can anyone help me with this? I have code that show the top 5 posts.
It only shows date and post. I would like it to show Title, Date, posted by, post.
here is what I have
<?
$query="SELECT title,threadid,forumid,replycount,views,firstposti d,dateline
FROM thread
WHERE forumid='$newsforumid'
ORDER BY dateline DESC
LIMIT 0,$items";
$newsitems=mysql_query($query,$db_connection);
while ($news=mysql_fetch_array($newsitems)) {
$thumbcount=0;
$query="SELECT pagetext,postid
FROM post
WHERE postid='$news[firstpostid]'
";
$posts=mysql_query($query,$db_connection);
while ($post=mysql_fetch_array($posts)) {
$news['dateline']=date("F j, Y",$news['dateline']);
$post['pagetext']=handle_bbcode_img($post['pagetext'],1);
$post['pagetext']=parse_bbcode($post['pagetext'],0,0);
$post['pagetext']=str_replace("<img src="",'<img src="',$post['pagetext']);
$post['pagetext']=str_replace("" border="0" alt="" />",'" border="0" alt="" />',$post['pagetext']);
?>
<tr>
<td width="100%" bgcolor="black"><?=$news['dateline']?><br>
<br>
<?=$post['pagetext']?></font><br>
<?
$query="
SELECT filename, filesize, visible, attachmentid, counter, postid, IF(thumbnail = '', 0, 1) AS hasthumbnail, LENGTH(thumbnail) AS thumbnailsize
FROM attachment
WHERE postid='$post[postid]'";
$attachments = mysql_query($query,$db_connection);
while ($attachment=mysql_fetch_array($attachments)) {
$show['clickforlarger'] = iif($attachment['thumbnailsize'] == $attachment['filesize'], false, true);
$attachment['filename'] = fetch_censored_text(htmlspecialchars_uni($attachme nt['filename']));
$attachment['attachmentextension'] = strtolower(file_extension($attachment['filename']));
$attachment['filesize'] = vb_number_format($attachment['filesize'], 1, true);
if ($attachment['visible'])
{
switch($attachment['attachmentextension'])
{
case 'gif':
case 'jpg':
case 'jpeg':
case 'jpe':
case 'png':
case 'bmp':
$thumbcount++;
if ($thumbcount >= 4)
{
$thumbcount = 0;
$show['br'] = "<br>";
}
else
{
$show['br'] = "";
}
?>
<a href="forums/attachment.php?attachmentid=<?=$attachment[attachmentid]?>" target="_blank"><img class="thumbnail" src="forums/attachment.php?attachmentid=<?=$attachment[attachmentid]?>&stc=1&thumb=1" border="0" alt="" /></a>
<?
echo $show['br'];
break;
default:
}
}
}
}
?><br>
</td>
</tr>
<tr>
<td width="100%" bgcolor="black">
</td>
</tr>
<?
}
?>
It only shows date and post. I would like it to show Title, Date, posted by, post.
here is what I have
<?
$query="SELECT title,threadid,forumid,replycount,views,firstposti d,dateline
FROM thread
WHERE forumid='$newsforumid'
ORDER BY dateline DESC
LIMIT 0,$items";
$newsitems=mysql_query($query,$db_connection);
while ($news=mysql_fetch_array($newsitems)) {
$thumbcount=0;
$query="SELECT pagetext,postid
FROM post
WHERE postid='$news[firstpostid]'
";
$posts=mysql_query($query,$db_connection);
while ($post=mysql_fetch_array($posts)) {
$news['dateline']=date("F j, Y",$news['dateline']);
$post['pagetext']=handle_bbcode_img($post['pagetext'],1);
$post['pagetext']=parse_bbcode($post['pagetext'],0,0);
$post['pagetext']=str_replace("<img src="",'<img src="',$post['pagetext']);
$post['pagetext']=str_replace("" border="0" alt="" />",'" border="0" alt="" />',$post['pagetext']);
?>
<tr>
<td width="100%" bgcolor="black"><?=$news['dateline']?><br>
<br>
<?=$post['pagetext']?></font><br>
<?
$query="
SELECT filename, filesize, visible, attachmentid, counter, postid, IF(thumbnail = '', 0, 1) AS hasthumbnail, LENGTH(thumbnail) AS thumbnailsize
FROM attachment
WHERE postid='$post[postid]'";
$attachments = mysql_query($query,$db_connection);
while ($attachment=mysql_fetch_array($attachments)) {
$show['clickforlarger'] = iif($attachment['thumbnailsize'] == $attachment['filesize'], false, true);
$attachment['filename'] = fetch_censored_text(htmlspecialchars_uni($attachme nt['filename']));
$attachment['attachmentextension'] = strtolower(file_extension($attachment['filename']));
$attachment['filesize'] = vb_number_format($attachment['filesize'], 1, true);
if ($attachment['visible'])
{
switch($attachment['attachmentextension'])
{
case 'gif':
case 'jpg':
case 'jpeg':
case 'jpe':
case 'png':
case 'bmp':
$thumbcount++;
if ($thumbcount >= 4)
{
$thumbcount = 0;
$show['br'] = "<br>";
}
else
{
$show['br'] = "";
}
?>
<a href="forums/attachment.php?attachmentid=<?=$attachment[attachmentid]?>" target="_blank"><img class="thumbnail" src="forums/attachment.php?attachmentid=<?=$attachment[attachmentid]?>&stc=1&thumb=1" border="0" alt="" /></a>
<?
echo $show['br'];
break;
default:
}
}
}
}
?><br>
</td>
</tr>
<tr>
<td width="100%" bgcolor="black">
</td>
</tr>
<?
}
?>