This is my "all_workers" table and "absent_workers" table
worker_id worker_name | id name
|
1 frank | 1 neil
2 tom | 2 ryan
3 neil | 3 david
4 steve | 4 steve
5 ryan | . .
6 david | . .
7 . |
I'm gonna select working workers now from all_workers table, but my codes not work. This is my codes:
<?php
include 'config.php';
$stmt = $conn->prepare('SELECT * FROM absent_workers');
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_array()){
$absent_name = $row['name'];
}
$stmt->close();
?>
<?php
include 'config.php';
$stmt = $conn->prepare('SELECT * FROM all_workers WHERE worker_name NOT IN ?');
$stmt->bind_param('s', $absent_name);
$stmt->execute();
$result = $stmt->get_result();
while ($row = $result->fetch_array()){
$worker_name = $row['worker_name'];
}
$stmt->close();
?>