I have this function that fetches the authors from db
function loadAuthors(){
$db=new DbConnect;
$con=$db->connect();
$stmt=$con->prepare("select * from authors");
$stmt->execute();
$authors=$stmt->fetchAll(PDO::FETCH_ASSOC);
return $authors;
}
I am calling this function here
function fetch(){
$result='';
$authors=loadAuthors();
while (list($k,$v)=each($authors)) {
$result.='<option value="'.$k.'">' .$v.'</option>';
}
return $result;
}
I am trying to populate the options of a select element but It gives me this output
Array
Array