There are 2 tables:
admin_files:
id | signature 1 | 1 2 | 1 3 | 1 support_files:
id | support_id | admin_file_id 1 | 2 | 1 2 | 2 | 2 3 | 2 | 3 function signature($id){ global $connection; $query = "SELECT a.* FROM admin_files a LEFT JOIN support_files s ON s.admin_file_id = a.id WHERE s.admin_file_id IS NULL"; $res = mysqli_query($connection, $query); $signature = array(); while($row = mysqli_fetch_assoc($res)){ $signature[$row['id']] = $row; } return $signature; }
Displays the difference, but does not work if you add a condition in
WHERE s.admin_file_id IS NULL AND a.signature= 1 AND s.support_id='$id'"; Conditions a.signature= 1 AND s.support_id='$id' are required, where can I put them?