SHARE
TWEET

books

a guest Oct 23rd, 2017 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <body>
  3. <?php
  4. $username="root";
  5. $password="";
  6. $database="bookdb";
  7. $con = mysql_connect("localhost",$username,$password);
  8. $db=mysql_select_db("bookdb",$con);
  9. $query = "select bname from book";
  10. $result=mysql_query($query);
  11. ?>
  12. <form method="post" action="bookdisp.php">
  13. search:<select name=sel>
  14. <?php
  15.  while ($row = mysql_fetch_array($result))
  16.  {
  17. ?>
  18. <option><?php echo $row['bname'];?>
  19. </option>
  20. <?php }?>
  21. </select>
  22. <input type="submit" value="search">
  23. </form>
  24. <?php
  25. mysql_close();
  26. ?>
  27. </body></html>
  28.  
  29.  
  30.  
  31.  
  32. <?php
  33. $username="root";
  34. $password="";
  35. $database="bookdb";
  36.  
  37. $selval=$_POST["sel"];
  38.  
  39. $con = mysql_connect("localhost",$username,$password);
  40. mysql_select_db("bookdb",$con);
  41.  
  42. $query = "select * from book where bname='$selval'";
  43. $result=mysql_query($query);
  44. echo "<table border=1><tr><th>BOOKID</th>
  45.  
  46. <th>BOOKNAME</th><th>BOOKpublisher</th><th>BOOKNumber</th></tr>";
  47.  
  48. $row = mysql_fetch_array($result);
  49.  
  50.  
  51. echo "<tr><td>",$row['bookid'] ,"</td><td> ", $row['bname']," </td><td>", $row['bpublisher']," </td><td>", $row['bnumber'],"</td><tr></table><br>";
  52.        
  53.  
  54.  
  55. mysql_close();
  56. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top