I wanted to put some data from the database in a combobox but I can not, I think the problem will be the connection to the database but I do not know what will be wrong, can you help me?
<?php
...
$dbconn = mysqli_connect($servername, $username, $password, $dbname)or die("Failed to connect to database:" . mysqli_error($dbconn));
$query = "SELECT nome FROM Medicos";
$data = mysqli_query($dbconn, $query);
$result = mysqli_num_rows($data);
?>
<form name="medicos" method="post" action="">
<label for="">Selecione um médico</label>
<select>
<option>Selecione...</option>
<?php while($prod = $result->fetch_assoc()) {
echo '<option value="'.$prod['nome'].'">'.$prod['nome'].'</option>';
}
?>
</select>