Jump to content
Larry Ullman's Book Forums

rajeshkhare

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by rajeshkhare

  1. On 3/20/2019 at 9:01 PM, Larry said:

    That means your SELECT query isn't working. You'll need to run it separately on the server to see what the results are (i.e., what the error is).

    <?php
    //reading the database
    $conn=mysqli_connect ("localhost", "root", "");
          if (!$conn) {
              echo "server connction error";
          }
          $db_conn = mysqli_select_db($conn, "test2");
          $sql = "select id, name, email, passwd from f_user";
          $query = mysqli_query($conn, $sql);
          
    ?>
    <table>
          <tr>
                <td><strong>username</strong></td>
                <td><strong>email</strong></td>
                <td><strong>Passwd</strong></td>
                <td><strong>Action</strong></td>
          </tr>
          <?php
    if (mysqli_num_rows($query)>=1){
          while ($row=mysqli_fetch_assoc($query)){

          ?>
          <tr>
                <td><?php echo $row['name'];?></td>
                <td><?php echo $row['email'];?></td>
                <td><?php echo $row['passwd'];?></td>
                <td><a href="edit.php?id=<?php echo $row['id'];?>"> Edit</a> I <a href
                ="delete.php?id=<?php echo $row['id']; ?>">Delete</a></td>
          </tr>
          <?php
    }}
    ?>
    </table>

×
×
  • Create New...