0
<?php
    $servername='localhost';
    $username='root';
    $password='';
    $dbname = "manager";

//connection avec la base de donné
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT ID, ContactID ,FirstName, LastName, phone, CEmail, Datein  ,group  FROM Contact";
$result = $conn->query($sql);

if ( !empty($result->num_rows) && $result->num_rows > 0) { // ...
  // output data of each row
    while($row = $result->fetch_assoc()) {
        echo "<tr>
        <td id='delete'>
         <input type='checkbox' id='row1' class='table-row'>
        </td>
        <td>". $row["id"]. "</td>
        <td>". $row["ContactID"]. "</td>
        <td>". $row["FirstName"]. "</td>
        <td>". $row["LastName"]. "</td>
        <td>". $row["Phone"] ."</td>
        <td>". $row["CEmail"]."</td>
        <td></td>
        <td>".$row["Datein"]."</td>
        <td></td>
        <td>".$row["Group"]."</td></tr><br>";
    }
} else {
    echo "0 results / error";
}

$conn->close();
?>

i use this code to print data from a table called contact but it doesn't and it prints "0 results / error" from the if statement but if i use the same code on another table "users" it works fine the tables:

Dharman
  • 30,962
  • 25
  • 85
  • 135

0 Answers0