I made an input for admin to write a message to a specific user. The user will be selected by a select who will fetch the users table from the names and list them all. After selecting someone, the admin can write the message, which would be saved in the bd with the "user" field equal to the one previously selected.
$resultado = mysqli_query($ligacao, $sql);
while ($row = mysqli_fetch_assoc($result)) {
$rows[] = $row;
}
return $rows;
$rows = db_select("SELECT name FROM utilizadores");
if ($rows === false) {
$error = db_error();
echo $rows;
// Handle error - inform administrator, log to file, show error page, etc.
}
I am not able to do the echo so I suppose the query is badly done, and if it is not, how clever does the result not select? I suppose it's inside the 'while' loop type:
while ($row = mysqli_fetch_assoc($result)) {
$rows[] = $row;
?>
<select>
<option>$rows[]</option>
</select>
<?php
}