I'm a beginner in PHP and I want to display data from a database MySQL, in a drop down list in a page of Wordpress. I used this code:
<tr>
<td> Owner </td>
<td>
<select name="owner">
<?php
// $connection = mysql_connect(localhost, root, );
$connection = mysql_connect(localhost, root, );
$sql = mysqli_query($connection, "SELECT Nom FROM `herboristes`");
while ($row = $sql->fetch_assoc()){
?>
</select>
<option value="owner1"><?php echo $row['Nom']; ?></option>
</td>
</tr>
The problem is that I get an empty dropdown list as you see in the image below:
Please, any suggestions. Thank you!