Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $con= new mysqli('localhost','root','','crudop');
- ?>
- <!doctype html>
- <html lang="en">
- <head>
- <!-- Required meta tags -->
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!-- Bootstrap CSS -->
- <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
- <title>display</title>
- </head>
- <body>
- <div class="container">
- <button type="button" class="btn btn-success my-5"><a href="user.php">Add User</a></button>
- <table class="table table-dark">
- <thead>
- <tr>
- <th scope="col">id</th>
- <th scope="col">visitors</th>
- <th scope="col">contact</th>
- <th scope="col">purpose</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $sql="Select * from company";
- $result=mysqli_query($con,$sql);
- if ($result){
- //step 1
- // $row=mysqli_fetch_array($result);
- // echo $row['name'];
- while ($row=mysqli_fetch_array($result))
- {
- $id=$row['id'];
- $visitors=$row['visitors'];
- $contact=$row['contact'];
- $purpose=$row['purpose'];
- echo'<tr>
- <th scope="row">'.$id.'</th>
- <td>'.$visitors.'</td>
- <td>'.$contact.'</td>
- <td>'.$purpose .'</td>
- <button type="button" class="btn btn-success my-5"><a href="update.php?updateid='.$id.'">update</a></button>
- <button type="button" class="btn btn-danger my-5"><a href="delete.php?deleteid='.$id.'">delete</a></button>
- </td>
- </tr>
- <tr>';
- }
- }
- ?>
- </tbody>
- </table>
- </div>
- <!-- Optional JavaScript; choose one of the two! -->
- <!-- Option 1: Bootstrap Bundle with Popper -->
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
- <!-- Option 2: Separate Popper and Bootstrap JS -->
- <!--
- <script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
- -->
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement