Sunda Cyber Army


* Sunda Cyber Army 2k17 *
Indonesia Defacer ~


Path : /home/dent/public_html/demo8a/
File Upload :
Current File : /home/dent/public_html/demo8a/count_working.php

<?php
$host = "webdev.iyaclasses.com";
$userid = "[youruserid]";
$userpw = "[yourpw]";
$db = "[database name]";

include '../pdloginvariables.php';

$mysql = new mysqli(
    $host,
    $userid,
    $userpw,
    $db
);


if($mysql->connect_errno) {
    echo "db connection error : " . $mysql->connect_error;
    exit();
}
?>
<html>
<head>
    <title>Movie counts</title>
    <style>
        body {
            background-color: burlywood;
            margin: 0 20px;
            text-align: center;
        }

        #container {
            padding: 30px;
            background-color: olive;
            text-align: left;
            color:white;
        }

        .label {
            float:left;
            clear:both;
            width: 70px;
            font-style: italic;
        }
        .box {
            float:left;  text-align:right;
            height: 20px; width: 200px; margin: 5px;
        }
        .bar {
            background-color: red; min-width: 30px;
        }

    </style>
</head>
<body>
<div id="container">
    <h1>Movie totals<hr></h1>

    <?php

    $sql1 = "SELECT COUNT(*) AS recordcount
          FROM movieView";

    $sql2 = "SELECT COUNT(*) AS recordcount, genre
          FROM movieView
          GROUP BY genre";

    $results1 = $mysql->query($sql1);

    $results2 = $mysql->query($sql2);
// print_r($results2);

//    if(!$results1) { echo "ERROR: " . $mysql->error();}

    $currentrow1 = $results1->fetch_assoc();

    echo "Total number of movies: " .
        $currentrow1["recordcount"] .
        "<br><br>";

    echo "Total number of movies by genre:<br>";
while($currentrow = $results2->fetch_assoc()) {
    echo $currentrow["genre"] . " :" .
        $currentrow["recordcount"] .
        "<br>";
}
    echo "<br><br>Totals visualized...<br><br>";

    ?>

    <?php
    $results2->data_seek(0);
    while($currentrow = $results2->fetch_assoc())  {
    ?>
    <div class='box'>
        <?php echo $currentrow["genre"] ?>
        :</div>
    <div class='box bar' style='width:<?php
        echo $currentrow["recordcount"] ?>px'>&nbsp;</div>
        <?php
        echo $currentrow["recordcount"] ?><br style='clear:both'>
    <?php } ?>
</body></html>