Advertisement
rofelbca

display

Jul 25th, 2024 (edited)
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.72 KB | Source Code | 0 0
  1. <?php
  2.    $con= new mysqli('localhost','root','','crudop');
  3.    
  4.    
  5. ?>    
  6. <!doctype html>
  7. <html lang="en">
  8.   <head>
  9.     <!-- Required meta tags -->
  10.     <meta charset="utf-8">
  11.     <meta name="viewport" content="width=device-width, initial-scale=1">
  12.  
  13.     <!-- Bootstrap CSS -->
  14.     <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  15.  
  16.     <title>display</title>
  17.   </head>
  18.   <body>
  19.     <div class="container">
  20.     <button type="button" class="btn btn-success my-5"><a href="user.php">Add User</a></button>
  21.  
  22.     <table class="table table-dark">
  23.   <thead>
  24.     <tr>
  25.       <th scope="col">id</th>
  26.       <th scope="col">visitors</th>
  27.       <th scope="col">contact</th>
  28.      
  29.       <th scope="col">purpose</th>
  30.      
  31.     </tr>
  32.   </thead>
  33.   <tbody>
  34.   <?php
  35.    $sql="Select * from company";
  36.    $result=mysqli_query($con,$sql);
  37.    if ($result){
  38.        //step 1
  39.        // $row=mysqli_fetch_array($result);
  40.        // echo $row['name'];
  41.  
  42.  
  43.        while ($row=mysqli_fetch_array($result))
  44.        {
  45.            $id=$row['id'];
  46.            $visitors=$row['visitors'];
  47.            $contact=$row['contact'];
  48.          
  49.            $purpose=$row['purpose'];
  50.  
  51.            echo'<tr>
  52.             <th scope="row">'.$id.'</th>
  53.             <td>'.$visitors.'</td>
  54.             <td>'.$contact.'</td>
  55.             <td>'.$purpose .'</td>
  56.            
  57.            
  58.  
  59.             <button type="button" class="btn btn-success my-5"><a href="update.php?updateid='.$id.'">update</a></button>
  60.             <button type="button" class="btn btn-danger my-5"><a href="delete.php?deleteid='.$id.'">delete</a></button>
  61.  
  62.  
  63.            
  64.             </td>
  65.                 </tr>
  66.                 <tr>';
  67.         }
  68.     }
  69. ?>
  70.   </tbody>
  71. </table>
  72.     </div>
  73.  
  74.     <!-- Optional JavaScript; choose one of the two! -->
  75.  
  76.     <!-- Option 1: Bootstrap Bundle with Popper -->
  77.     <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
  78.  
  79.     <!-- Option 2: Separate Popper and Bootstrap JS -->
  80.     <!--
  81.    <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
  82.    <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
  83.    -->
  84.   </body>
  85. </html>
  86.  
  87.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement