<?php include_once 'sql_cls.php'; $sql = new sql_cls(); $where = array(); $w = ""; foreach ($_POST["Search_restrictions"] as $key => $val) { if ($key == "Platform") { if ($val != "NA") { ARRAY_PUSH($where, " b.consolePcName = '" . $val . "' "); } } } if (!empty($where)) { $w = "WHERE "; foreach ($where as $val) { $w .= $val; } } $result = $sql->query("\n\t\tSELECT count(l.gameName) AS 'Game Count'\n\t\tFROM gameName l\n\t\tINNER JOIN consolePc b\n\t\tON l.gameId = b.gameId\n\t\t{$w}\n\t"); if ($result != NULL && $result->num_rows > 0) { while ($row = mysqli_fetch_assoc($result)) { echo ceil(intval($row["Game Count"]) / 10); } }
<div class='recentlyAdded'> <h2>Recently Added</h2> <div class='recentlyAdded_rst'></div> </div> </div> <div id='rightCol'> <h2>Profile</h2> <div> <?php $columns = array("First Name" => "firstName", "Last Name" => "lastName"); $i = 0; $colomn_str = ""; foreach ($columns as $keys => $val) { if ($i != 0) { $colomn_str .= " ," . $val . " AS '" . $keys . "' "; } else { $colomn_str .= $val . " AS '" . $keys . "' "; } $i++; } $data = mysqli_fetch_assoc($sql->query("\n\t\t\t\t\t\tSELECT " . $colomn_str . "\n\t\t\t\t\t\tFROM users\n\t\t\t\t\t\tWHERE userID = " . $_SESSION["User"] . "\n\t\t\t\t\t")); foreach ($data as $key => $val) { echo "<div class='column_line'><span class='value_lbl'>" . $key . ":</span><span class='value_val'><span>" . $val . "</span><input type='checkbox' class='editVal'/></span></div><br/>"; } ?> </div> </div> </body> </html>
<?php include_once 'sql_cls.php'; $sql = new sql_cls(); $where = array(); $w = ""; foreach ($_POST["Search_restrictions"] as $key => $val) { if ($key == "Platform") { if ($val != "NA") { ARRAY_PUSH($where, " b.consolePcName = '" . $val . "' "); } } } if (!empty($where)) { $w = "WHERE "; foreach ($where as $val) { $w .= $val; } } $result = $sql->query("\n\t\tSELECT l.gameName AS 'Game Name', b.consolePcName AS 'Console'\n\t\tFROM gameName l\n\t\tINNER JOIN consolePc b\n\t\tON l.gameId = b.gameId\n\t\t{$w}\n\t\tORDER BY l." . str_replace(" ", "", $_POST["Order_By"]["Feild"]) . " " . $_POST["Order_By"]["Order"] . "\n\t\tLIMIT " . INTVAL($_POST["Page_Size"]) * (INTVAL($_POST["Page"]) - 1) . " , " . $_POST["Page_Size"] . ";\n\t\t\n\t"); if ($result != NULL && $result->num_rows > 0) { while ($row = mysqli_fetch_assoc($result)) { echo "<tr class='feild_find'>\n\t\t\t\t<td class='game_name'>\n\t\t\t\t\t" . $row["Game Name"] . "\n\t\t\t\t</td>\n\t\t\t\t<td class='game_platform'>\n\t\t\t\t\t" . $row["Console"] . "\n\t\t\t\t</td>\t\t\t\t\t\t\n\t\t\t</tr>"; } }
</div> <hr> <div class='recentlyAdded'> <h2>Recently Added</h2> <div class='recentlyAdded_rst'></div> </div> </div> <div id='rightCol'> <div style='float:left; border:1px dashed grey;margin-top:15px;height: 100%;padding: 10px'> <h3>Search Options</h3> <hr> <label for='platform_typ'>Platform</label> <select id='platform_typ'> <option value='NA'>N/A</option> <?php $result = $sql->query("SELECT DISTINCT consolePcName FROM consolepc"); if ($result->num_rows != 0) { while ($row = mysqli_fetch_assoc($result)) { echo "<option value='" . $row['consolePcName'] . "'>" . $row['consolePcName'] . "</option>"; } } ?> </select> </div> <div> <h2> List of Games </h2> <?php $result = $sql->query("Call selectGame( 0 , 10)"); echo "<table class='showTable' style + 'border:1px solid black'>"; echo "<tr><th colspan = 2>Games</th></tr>"; echo "<tr class='headings'>\n\t\t\t\t\t\t\t<th class='search_header'>Game Name <span>˄</span></th>\n\t\t\t\t\t\t\t<th class='search_header'>Console <span>˄</span></th>\n\t\t\t\t\t\t</tr><span>";