从db获取数据并在下拉列表中显示

Would like to fetch the details from table and display in dropdown but below code displays only dropdown without any data.not sure whats worng.

<?php
    include 'config.php';
    $sql = "select name from finance";
    $result = mysqli_query($con,$sql);
    echo "<select name='name'>";
    while ($row = mysqli_fetch_row($result)) {
        echo "<option value='" . $row['name'] ."'>" . $row['name'] ."</option>";
    }
    echo "</select>";
?>

can some please advice.

mysqli_fetch_row does not return associated array.

Instead, Use mysqli_fetch_array

Also, check if your query is returning any record