View file cat.php

File size: 0.98Kb
<?php

require_once('inc/config.php');

$sqlc = mysql_query("SELECT * FROM `cat` WHERE `id_cat`=0 AND `id`='".intval($_GET['id'])."'");
if(mysql_num_rows($sqlc) == 0){
echo '<div class="error"><b>Ошибка</b><br/>Раздел не существует</div>';
}else{
while($sc = mysql_fetch_array($sqlc)){
echo '<div class="cmenu">';
echo '<div class="bmenu">'.$sc['name'].'</div>';
$sqlf = mysql_query("SELECT * FROM `cat` WHERE `id_cat`='".intval($sc['id'])."'");
if(mysql_num_rows($sqlf) == 0){
echo '<div class="error">Раздел пуст</div>';
}else{
while($sf = mysql_fetch_array($sqlf)){
$tem = mysql_result(mysql_query("SELECT COUNT(*) FROM `temy` WHERE `id_cat`='".intval($sf['id'])."'"), 0 );
$postov = mysql_result(mysql_query("SELECT COUNT(*) FROM `posty` WHERE `id_cat`='".intval($sf['id'])."'"), 0 );
echo '<div class="menu">&raquo; <a href="forum.php?id='.$sf['id'].'">'.$sf['name'].'</a> ('.$tem.'/'.$postov.')</div>';
}
}
echo '</div>';
}
}

require_once('inc/end.php');

?>