TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,973
  • Latest: NonStop
Stats
  • Total Posts: 196,240
  • Total Topics: 21,353
  • Online today: 722
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 265
  • Total: 265

Recent Articles Block showing up-aproved articles

Started by gffb, May 28, 2007, 03:47:04 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

gffb

I am using the code below toshow recent articles and it work fine except it shows a link to articles that are waiting aproval, if the link it clicked it will not show the article but would rather it did not show article till aproved. any ideas?
global $db_prefix, $scripturl;

$articles = db_query("
        SELECT art.date, art.author, art.subject, art.id, var.value1 AS category_name
        FROM {$db_prefix}tp_articles AS art
                LEFT JOIN {$db_prefix}tp_variables AS var ON (var.id = art.category)
        LIMIT 10", __FILE__,__LINE__);

echo '
<table cellspacing="0" cellpadding="0" width="100%" >';

if (mysql_fetch_assoc($articles) == 0)
        echo '
<tr>
<td>No Articles Submitted</td>
</tr>';
else
{
        while ($row = mysql_fetch_assoc($articles))
                echo '
<tr>
<td><font size="1">
<a href="', $scripturl ,'?page=', $row['id'], '"><b>', $row['subject'], '</b></a>
<div style="padding: 4px; padding-top: 0px;">
By : <b>', $row['author'], '</b><br />
Category: ', $row['category_name'], '
</div>

</td>
</tr>';


}
echo '
</table>';

mysql_free_result($articles);

This website is proudly hosted on Crocweb Cloud Website Hosting.