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(); }
<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) { while ($row = $result->fetch_assoc()) {