Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1.  
  2. <?php
  3. $servername="localhost:3306";
  4. $username="root";
  5. $password="Admin1234";
  6. $dbname="asirweb";
  7.  
  8. $conn = mysqli_connect($servername, $username, $password, $dbname);
  9.  
  10.  
  11.  
  12. if (!$conn) {
  13. die("Connection failed: " . mysqli_connect_error());
  14. }
  15.  
  16.  
  17.  
  18. $query = "SELECT user FROM login";
  19.  
  20. $result = mysqli_query($conn, $query);
  21.  
  22. ?>
  23. <html>
  24. <head>
  25. <style>
  26. /* https://www.w3schools.com/css/tryit.asp?filename=trycss_table_striped */
  27. table {
  28. border-collapse: collapse;
  29. width: 100%;
  30. }
  31. th, td {
  32. text-align: left;
  33. padding: 8px;
  34. }
  35. tr:nth-child(even) {background-color: #f2f2f2;}
  36. </style>
  37. </head>
  38. <body>
  39. <table>
  40.  
  41. <?php
  42. // output data of each row
  43. while($row = mysqli_fetch_array($result)){
  44.  
  45.  
  46.  
  47.  
  48. ?>
  49. <tr>
  50. <td>
  51. <?php echo $row[0] ?>:
  52. </td>
  53. <td>
  54. <form action="delete.php" method="POST">
  55. <input type="hidden" name="nombre" value="<?php echo $row[0] ?>">
  56. <input type="submit" value="delete">
  57. </form>
  58. </td>
  59. <td>
  60. <form action="update.php" method="POST">
  61. <input type="hidden" name="nombre" value="<?php echo$row[0] ?>">
  62. <input type="submit" value="update">
  63. </form>
  64. </td>
  65. </tr>
  66. <?php
  67. } // while
  68. ?>
  69. </table>
  70. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement