function abc() { $obDBRel = new DBRel(); //Connecting PHP with DBMS and Obtaining Result of a query $conn = $obDBRel->DBConn(); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT Sub_Name FROM Subject"; $result = $conn->query($sql); //Inserting values in dropdown echo "<select name='SUB'>"; echo "<option value='subject'>Subject</option>"; if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { echo "<option value='" . $row['Sub_Name'] . "'>" . $row['Sub_Name'] . "</option>"; } } else { echo "0 results"; } echo "</select>"; //Saving Resource $conn->close(); }
<title>Feedback - Admin</title> <link rel="stylesheet" type="text/css" href="fullfec.css"> </head> <body> <header> <a href='feedback.php'><img src="../images/back.png"></a> <img src ="../images/tellus-logo.png"/> <span> <a href="../logout.php">Logout</a> </span> </header> <article> <h1>Complete Feedback:</h1> <div class=output> <?php $obDBRelb = new DBRel(); $conn = $obDBRelb->DBConn(); $sql = "Select * from feedback order by Fed_No asc"; $result = $conn->query($sql); echo "<table class=slist>"; echo "<tr>"; echo "<th>Feedback No.</td>"; echo "<th>Roll No.</td>"; echo "<th>Subject Name</td>"; echo "<th>Feedback</td>"; echo "<th>Q1</td>"; echo "<th>Q2</td>"; echo "<th>Q3</td>"; echo "<th>Avg</td>"; echo "</tr>"; if ($result->num_rows > 0) {
<?php session_start(); include "../bucket.php"; $obDBRel = new DBRel(); $obDBRel->redirect(); ?> <!DOCTYPE html> <head> <title>Admin Page</title> <link rel="stylesheet" type="text/css" href="admin.css"> </head> <body> <header> <img src ="../images/tellus-logo.png"/> <span> <a href="../logout.php">Logout</a> </span> </header> <article> <h1>Admin's Utility Space:</h1> <div class=main> <div> <div class=lnkimg> <a href='addsub.php'><img src="../images/add.png"></a> </div> <div class=shorten> <h3>Add Subject</h3> <p>Click to insert subjects to the database for adding feedback.</p> </div> </div>
<?php error_reporting(0); session_start(); include "../bucket.php"; $obDBRel = new DBRel(); $obDBRel->redirectlogin(); //Connecting to DB $conn = $obDBRel->DBConn(); //Obtaining Values from Tables $sql = "SELECT * FROM student"; $result = $conn->query($sql); $flag = 0; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $_SESSION['user'] = $_POST['user']; $_SESSION['pass'] = $_POST['pass']; //Checking the entered username (admin) if ($_SESSION['user'] == 'admin' && $_SESSION['pass'] == 'admin') { header('location: ../admin/admin.php'); } //Checking the entered username (student) while ($row = $result->fetch_assoc()) { if (trim($_POST['user']) == trim($row['Roll_No']) && trim(md5($_POST['pass'])) == trim($row['Pass'])) { $flag = 1; } } if ($flag == 1) { header('Location:../student/student.php'); } else { echo "<script> alert('Wrong Username or Password!'); </script>"; }