<?php
ob_start();
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$maindb = "rooms";
$formname = "Rooms Print";
$file = "rooms_print_fr.php";

// $fseries = $_SESSION["series_" . $dbname];
// $keycond = " and `series`='$fseries'";
$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
$myyear = $_SESSION[$myyear];
$zroot = $_SESSION["zdir"];
$zcomp = $_SESSION["comp_" . $dbname];
$fsocity = $_SESSION["society_" . $dbname];
$getcomp = mysqli_query($conn, "SELECT * FROM $zroot.`company` where `code` = '$fseries'")or die(mysqli_error($conn));
$comp = mysqli_fetch_array($getcomp);

mysqli_select_db($conn, $zdb);

$category = $_POST['category'];
$type = $_POST['type'];
$view = $_POST['view'];

$categorycond = "";
$typecond = "";
$viewcond = "";

if (!empty($category)) {
    $categorycond = " AND `category`='$category' ";
}
if (!empty($type)) {
    $typecond = " AND `type`='$type' ";
}
if (!empty($view)) {
    $viewcond = " AND `view`='$view' ";
}


$getpmain = mysqli_query($conn, "SELECT * FROM `$maindb` WHERE code != ''  $categorycond $typecond $viewcond ")or die(mysqli_error($conn));

if (isset($_POST["view"])) {
    include("includes/linkshead.php");
    ?>
    <script src="MyScript/item.js" type="text/javascript"></script>
    </head>
    <body>
        <div class="container">
            <?php include("includes/head_rep.php"); ?>
            <div class="row">
                <div class="col-lg-12">
                    <table class="table table-condensed table-bordered">
                        <tr class="mySearchTr">
                            <th width="5%">Sr.</th>
                            <th width="15%">Category</th>
                            <th width="15%">Type</th>
                            <th width="15%">View</th>
                        </tr>
                        <?php
                        $ctr = 1;
                        while ($pmain = mysqli_fetch_array($getpmain)) {

                            $category  = $pmain['category'];
                            $type  = $pmain['type'];
                            $view  = $pmain['view'];

                            Echo "<tr>";
                            Echo "<td>$ctr</td>";
                            Echo "<td>$category</td>";
                            Echo "<td>$type</td>";
                            Echo "<td>$view</td>";
                           
                            Echo "</tr>";
                            $ctr++;
                        }
                        ?>
                    </table>
                </div>
            </div>
        </div>

        <?php include("includes/linksfoot.php"); ?>
    </body>
    </html>
    <?
}

?>

