$users = [
'u101',
'u402',
'u503',
'u703',
'u114',
'u148',
'u152',
'u173',
'u134'
];
$sql = "SELECT * FROM `tel` WHERE `datetime` BETWEEN '$begin_date' AND '$end_date' AND (";
foreach ($users AS $user) {
$sql .= "`akk` = '$user' OR";
}
$sql .= ") ORDER BY `tel`.`datetime` DESC";
echo $sql . "<br>";
$users = [
'u101',
'u402',
'u503',
'u703',
'u114',
'u148',
'u152',
'u173',
'u134'
];
$string = implode(" OR ", $users); // u101 OR u402 OR u503 OR u703 OR u114 OR u148 OR u152 OR u173 OR u134;
"... WHERE `akk` IN (" . implode(",", $users) . ");";