Example #1
0
            </form>
	</div>
	<div class="row" align="center" style="margin-bottom:10px">
        <table class="table table-condensed">
        <tr>
            <th class="info" >ID</th>
            <th class="info" >Tiêu đề Bài viết được bình luận</th>
			<th class="info" >Nội dung</th>
            <th class="info" >Người đăng</th>
			<th class="info" >Kiểm duyệt</th>
            <th class="info" >Ngày dăng</th>
            <th class="info" width="183" >Tác vụ</th>
        </tr>
        <?php 
require_once "../PHP/ConnectDB.php";
$conn = ConnectDB::connect();
$sql = "SELECT A.ID, B.TieuDe, A.NoiDung, A.TenDN, A.KiemDuyet, A.NgayBinhLuan FROM BinhLuan AS A INNER JOIN BaiViet AS B ON A.IDBinhLuan = B.ID ORDER BY A.ID DESC";
if (array_key_exists('slKiemDuyet', $_POST)) {
    if ($_POST['slKiemDuyet'] != '2') {
        $sql = "SELECT A.ID, B.TieuDe, A.NoiDung, A.TenDN, A.KiemDuyet, A.NgayBinhLuan FROM BinhLuan AS A INNER JOIN BaiViet AS B ON A.IDBinhLuan = B.ID WHERE A.KiemDuyet = " . $_POST['slKiemDuyet'] . " ORDER BY A.ID DESC";
    }
}
//Code phan trang
$row_per_page = 10;
// Số dòng trên mỗi trang
$resultAll = mysqli_query($conn, $sql);
$rows = $resultAll->num_rows;
//Số dòng cần hiển thị
//Tính số trang cần hiển thị
if ($rows > $row_per_page) {
    $page = ceil($rows / $row_per_page);
Example #2
0
            </div>
            <div class="col-md-9" align="left">
            	<p align="justify"><?php 
echo $row['TenDN'];
?>
</p>
            </div>
        </div>
        <div class="row">
        	<div class="col-md-2 control-label" align="right">
            	<label>- Danh mục:</label>
            </div>
            <div class="col-md-9" align="left">
            	<p align="justify">
					<?php 
$connDM = ConnectDB::connect();
$sqlDM = "SELECT * FROM DanhMuc WHERE ID = " . $row['IDDanhMuc'];
$resutDM = mysqli_query($connDM, $sqlDM);
if ($resutDM->num_rows > 0) {
    $rowDM = $resutDM->fetch_assoc();
    echo $rowDM['TenDanhMuc'] . " - <strong>Mô tả:</strong> " . $rowDM['MoTa'];
}
ConnectDB::disconnect();
?>
                </p>
            </div>
        </div>
        <div class="row">
        	<div class="col-md-2 control-label" align="right">
            	<label>- Kiểm duyệt:</label>
            </div>