PHP drop-down menu with items in the database

advertisements

I can't seem to get values of a table in my dropdownlist. I get no errors, only an empty dropdownlist. This is my code:

<?php
include_once ("classes/Keten.class.php");
$keten = new Keten();
$allKet = $keten->getAllKetens();

echo '<select name="fk_keten_id">';
while($row = mysql_fetch_array($allKet))
{
  echo '<option value="' .
       $row['pk_keten_id'] . '">' . $row['keten_naam'] . '</option>';
}
echo '</select>';
?>

Function getAllKetens works, because I use it in an other page.

Thanks in advance :)

on request, the getAllKet() function in classes/Keten.class.php

public function getAllKetens()
    {
        include ("connection.php");
        $sSql = "SELECT * FROM tblKetens;";
        $vResult = mysqli_query($link, $sSql);
        mysqli_close($link);
        return($vResult);
    }


I'm not sure mixing mysqli and mysql commands can be done, in your fetch_array you used mysql_fetch_array instead of mysqli_fetch_array.