I have this function in an included file
function ListModules() {
try {
global $DBH;
$ListModules->query("SELECT * FROM modules");
$ListModules->execute();
return $ListModules->fetchAll();
} catch (PDOException $e) {
file_put_contents('PDOErrors.txt', $e->getMessage(), FILE_APPEND);
} }
Then I'm trying to echo them into a drop down box like this:
echo "<select name='deletelist' class='form-control'>
<option value='0'>Choose a module to delete</option>";
while($modulelist = ListModules()) {
echo "<option value='".$moduelist['id']."'>".$modulelist['name']."</option>";
}
echo "</select>";
What am I doing wrong?