<?php
$sql_tbl_usrs = "SELECT * FROM users, department, usergroup WHERE users.department = department.id AND users.usergroup = usergroup.id";
$result_tbl_usrs = mysqli_query($connection, $sql_tbl_usrs);
while ($row_tbl_usrs = mysqli_fetch_array($result_tbl_usrs)) {
echo '<tr>
<td></td>
<td>' . $row_tbl_usrs['last_name'] . ' ' . $row_tbl_usrs['first_name'] . ' ' . $row_tbl_usrs['patronymic'] . '</td>
<td>' . $row_tbl_usrs['function'] . '</td>
<td>' . $row_tbl_usrs['department'] . '</td>
<td>' . $row_tbl_usrs['usergroup'] . '</td>
<td>' . $row_tbl_usrs['login'] . '</td>
<td>' . $row_tbl_usrs['date_registration'] . '</td>
</tr>';
}
?>
<?php require_once('connect.php')?>
<div>
<select>
<?php
$sql = "SELECT * FROM department";
$result = mysqli_query($connection, $sql);
while ($row = mysqli_fetch_array($result)) {
echo '<option value="' . $row['id'] . '">' . $row['department'] . '</option>';
}
?>
</select>
</div>
<?php require_once('connect.php')?>
<div>
<select>
<?php
$sql = "SELECT * FROM department";
$result = mysqli_query($sql) or die('Запрос не удался: ' . mysql_error());
$row_cnt = mysqli_num_rows($result);
echo $row_cnt;
while ($row = mysqli_fetch_array($result, MYSQL_ASSOC)) {
echo '<option value="' . $row['id'] . '">' . $row['department'] . '</option>';
}
?>
</select>
</div>