<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "test";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id_user, id_district FROM rabotniki";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo $row["id_user"] . $row["id_district"];
}
} else {
echo "0 results";
}
$conn->close();
?>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "test";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id_user, id_district FROM rabotniki";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo $row["id_user"] . $row["id_district"];
}
} else {
echo "0 results";
}
$conn->close();
?>
<table>
<tr>
<td>Вася</td>
<td>Центр</td>
</tr>
<tr>
<td>Вася</td>
<td>Курчатоский</td>
</tr>
<tr>
<td>Петя</td>
<td>Центр</td>
</tr>
</table>
<select name="rabotniki[]" class="rabotniki" multiple="multiple">
<?php
foreach ($rabotniki as $rab) {
?>
<option class="noSelectMultiple<?= $rab[id] ?>"
value="<?= $rab[name] ?>"> <?= $rab[name] ?></option>
<?php } ?>
</select>
Я сейчас услышал ответ типа "Откуда берутся дети? - они рождаются"