Hi guys.
I am creating a cms for my own and am rather new to php and databases.
what i want is to simply display each item on my mysql database in a list and display each image with the title next to it.
I currentiy have this code on my index page:
<?php
include_once('include/connection.php');
include_once('include/article.php');
$app = new article;
$apps = $app->fetch_all();
?>
<html>
<head>
<title>App Donate</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<ol>
<?php foreach ($apps as $app) { ?>
<li><a href="article.php?id=<?php echo $apps['app_id']; ?>">
<img src="<?php echo $row_getdetails['app_img']; ?>" alt="Image from DB" />
<?php echo $apps['app_title']; ?>
</a>
<?php } ?>
</li></ol>
</div>
</body>
</html>
include/article.php
<?php
class article {
public function fetch_all(){
global $pdo;
$query = $pdo->prepare("SELECT * FROM `apps`");
$query->execute();
return $query->fetchAll();
}
public function fetch_data($app_id) {
global $pdo;
$query = $pdo->prepare("SELECT * FROM apps WHERE app_id = ?");
$query->bindValue(1, $app_id);
$query->execute();
return $query->fetch();
}
}
?>
my index page can be found HERE
as you can see it has seen that there is 2 posts in my databace but it just is not displaying the content.
please can someone help?
THANK YOU.