Guest User

Untitled

a guest
Oct 18th, 2016
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. <?php
  2. $servername ="localhost";
  3. $username="root";
  4. $password="jit123";
  5. $dbname="1jt14cs007db3";
  6.  
  7. $conn= new mysqli($servername,$username,$password,$dbname);
  8.  
  9. if($conn->connect_error)
  10. {
  11. die("CONN failed :" . $conn->connect_error);
  12. }
  13. else
  14. {
  15. /*$sqlquery="select * from student";
  16. $result = $conn->query($sqlquery);
  17. if($result->num_rows>0)
  18. {echo "<table align=\"center\"border=1> <tr> <th> REG num </th> <th>STUDENT name</th><th>MAJOR</th><th>DOB</th></tr>";
  19. while($row=$result->fetch_assoc())
  20. {
  21.  
  22. echo "<tr><td>$row[regno]</td><td>$row[name]</td><td>$row[major]</td><td>$row[bdate]</td></tr>";
  23.  
  24. }
  25. echo "</table>";
  26. }
  27. else echo "empty set";*/
  28.  
  29. $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";
  30. $result = $conn->query($sqlquery);
  31. if($result->num_rows>0)
  32. {echo "<table align=\"center\"border=1> <tr> <th> Course No. </th> <th>Book ISBN</th><th>Book Title</th></tr>";
  33. while($row=$result->fetch_assoc())
  34. {
  35.  
  36. echo "<tr><td>$row[cno]</td><td>$row[bookisbn]</td><td>$row[booktitle]</td></tr>";
  37.  
  38. }
  39. echo "</table>";
  40. }
  41. else echo "empty set";
  42.  
  43. }
  44.  
  45.  
  46. $conn->close();
  47. ?>
Add Comment
Please, Sign In to add comment