Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername ="localhost";
- $username="root";
- $password="jit123";
- $dbname="1jt14cs007db3";
- $conn= new mysqli($servername,$username,$password,$dbname);
- if($conn->connect_error)
- {
- die("CONN failed :" . $conn->connect_error);
- }
- else
- {
- /*$sqlquery="select * from student";
- $result = $conn->query($sqlquery);
- if($result->num_rows>0)
- {echo "<table align=\"center\"border=1> <tr> <th> REG num </th> <th>STUDENT name</th><th>MAJOR</th><th>DOB</th></tr>";
- while($row=$result->fetch_assoc())
- {
- echo "<tr><td>$row[regno]</td><td>$row[name]</td><td>$row[major]</td><td>$row[bdate]</td></tr>";
- }
- echo "</table>";
- }
- else echo "empty set";*/
- $sqlquery="select c.cno, t.bookisbn, t.booktitle from course c, bookadoption b, text t where c.cno=b.cno and t.bookisbn=b.bookisbn and c.dept='cs' and c.cno in (select cno from bookadoption group by cno having count(*)>2) order by c.cno, t.booktitle";
- $result = $conn->query($sqlquery);
- if($result->num_rows>0)
- {echo "<table align=\"center\"border=1> <tr> <th> Course No. </th> <th>Book ISBN</th><th>Book Title</th></tr>";
- while($row=$result->fetch_assoc())
- {
- echo "<tr><td>$row[cno]</td><td>$row[bookisbn]</td><td>$row[booktitle]</td></tr>";
- }
- echo "</table>";
- }
- else echo "empty set";
- }
- $conn->close();
- ?>
Add Comment
Please, Sign In to add comment