Please how can I display client single data and not duplicate them. As you can see on the result it duplicate each client twice.
When I run the code this is what I get
This is what I want
This are MySQL tables
First table
Second table
This is my code
<?php
require_once 'db_connect.php';
$varCurDate = date("Y-m-d");
$sqlabs = "SELECT * FROM tbl_absent HAVING (startDate = '$varCurDate' AND endDate > '$varCurDate')";
$resultabs = mysqli_query($conn, $sqlabs);
if (mysqli_num_rows($resultabs) > 0) {
while ($rowabs = mysqli_fetch_assoc($resultabs)) {
$varSpecialId = $rowabs["specialId"];
$varUserName = $rowabs["userName"];
$varStartDate = $rowabs["startDate"];
$varEndDate = $rowabs["endDate"];
$sql = "SELECT * FROM tbl_clients WHERE (specialId != '$varSpecialId') GROUP BY specialId";
$result = mysqli_query($conn, $sql);
while ($row = mysqli_fetch_assoc($result)) {
echo "
<tr>
<td>" . $row["userId"] . "</td>
<td>" . $row["userName"] . "</td>
<td>" . $row["userEmail"] . "</td>
<td>" . $row["userPhone"] . "</td>
<td>" . $row["specialId"] . "</td>
</tr>
";
}
}
} else {
echo "0 results";
}
mysqli_close($conn);
?>