myselected array contains 4,5,88
1 2 3 4 5 6 7 8 9 10 11 12 |
$sql = "SELECT * FROM workers WHERE id IN (".implode(',',$myselected).")"; if(!$result = $mysqli->query($sql)){ die('There was an error running the query [' . $mysqli->error . ']'); } while($row = $result->fetch_assoc()){ echo $row['fname']; } } |