I have been trying for over a day now to get FetchAll() method to help me display array from database. But all my efforts have failed. Instead of the print_r() returning an array, it gives me this array(). Kindly, help me out. The code in class page :
class Article {
public function fetch_all(){
global $conn;
$ass = $conn->prepare("SELECT * FROM articles");
$ass->execute();
return $ass->fetchAll();
}
}
while the code in display page is:
$article = new Article;
$articles = $article->fetch_all();
print_r($articles);