function GetSubsections($section) { $subs = ""; $qr = mysql_query("SELECT name FROM sections WHERE parent='{$section}'") or die(mysql_error()); while ($r = mysql_fetch_array($qr)) { $subs .= "sname='" . $r['name'] . "' OR "; $subs .= GetSubsections($r['name']); } return $subs; }
</table> </div> <br /> <h3><?php echo $title; ?> : Latest</h3> <div class="boxmenu"> <table> <?php $s = GetSubsections($sect) . " sname='{$sect}' "; $qr = mysql_query("SELECT aid,title,views,author,sname FROM articles WHERE {$s} " . " order by timestamp desc limit 0,10 ") or die(mysql_error()); while ($r = mysql_fetch_array($qr)) { print "<tr>"; print "<td valign='top'><img src=\"./i/file.gif\" /></td>"; print "<td><a href=\"index.php?section={$r['sname']}&aid={$r['aid']}\">"; print "{$r['title']}</a> ({$r['views']}) by <i>{$r['author']}</i></td>"; print "</tr>"; } ?> </table> </div> <br />