Denis062
Новичок
PHP:
<?php
require_once 'config.php';
$category_id = (int)$_GET['category_id'];
// получаем название категории
$res_section = mysql_query("SELECT `name` FROM `section` WHERE `category_id`='{$category_id}'");
$row_section = mysql_fetch_assoc($res_section);
// выбираем статьи категории
$res_articles = mysql_query("SELECT `article_id`, `title`, `date`, `short_text`, `views` FROM `articles`
WHERE `category`='{$category_id}' AND `visible`='1'");
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Блог <?php echo $row_section["name"] ;?></title>
<link href="../css/stayle.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
require_once 'phppages/gmenu.php';
require_once 'phppages/lbloc.php';
require_once 'phppages/rbloc.php';
?>
<div class="content1">
<?php
if (mysql_num_rows($res_articles) >0){
while ($row_articles = mysql_fetch_assoc ($res_articles)){
echo '<div class="articles">' ."\r\n";
echo '<h2><a href="' .$site_url. 'view_artical.php?article_id=' .$row_articles["article_id"]. '">'.htmlspecialchars($row_articles["title"]). '</a></h2>'. '<br />' ."\r\n";
echo $row_articles["short_text"]. '<hr />' ."\r\n";
echo '<div class="articles1">' ."\r\n";
echo '<p> <b>Date:</b> '.$row_articles["date"]. '| <b>Просмотров:</b> '.$row_articles["views"]. '</p>' ."\r\n";
echo '</div>';
echo '</div>';
}
}else echo 'There are no articles';
?>
</div>
<div class="clear"></div>
<div class="indent"></div>
</div>
<?php require_once 'phppages/footer.php'; ?>