0

I have got warning error while connecting table details for crud operation. Warning: mysqli_query() expects parameter 1 to be mysqli, object given in C:\xampp\htdocs\login_pdo\display.php on line 32

conn.php

<?php
    $db_username = 'root';
    $db_password = '';
    $conn = new PDO( 'mysql:host=localhost;dbname=db_login', $db_username, $db_password );
    if(!$conn){
        die("Fatal Error: Connection Failed!");
    }
?>

display.php

<?php
include 'conn.php';

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Crud Operation </title>
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css"/>
</head>
<body>
    <div class="container">
        <button class="btn btn-primary my-5"><a href="registration.php" style="color:white;">Add User</a>
            </button>
            <table class="table">
  <thead>
    <tr>
      <th scope="col">mem_id</th>
      <th scope="col">Firstname</th>
      <th scope="col">Lastname</th>
      <th scope="col">Username</th>
      <th scope="col">Password</th>
    </tr>
  </thead>
  <tbody>
    <?php
    $sql="Select * from 'member' ";
    $result=mysqli_query($conn,$sql);
    if($result){
        $row=mysqli_fetch_assoc($result);
        echo $row['firstname'];
    }
    ?>
    
    // <!-- // <tr>
    //   <th scope="row">1</th>
    //   <td>Mark</td>
    //   <td>Otto</td>
    //   <td>@mdo</td>
    // </tr>
    // <tr>
    //   <th scope="row">2</th>
    //   <td>Jacob</td>
    //   <td>Thornton</td>
    //   <td>@fat</td>
    // </tr>
    // <tr>
    //   <th scope="row">3</th>
    //   <td colspan="2">Larry the Bird</td>
    //   <td>@twitter</td>
    // </tr> -->
  </tbody>
</table>
    </div>
</body>
</html>

I have tried changing the parameter, still pop up with same error.

0 Answers0