I have a website that is made in php and mysql.
It is a podcast site which I have created.
The home page has a list of podcasts and once one is clicked it then brings up the episode.php?id= followed by the ID that is listed in mysql for that podcast.
at the bottom of the episodes page I have added a comment box.
and I have it to display the comments saved in mysql using:
<?php class feedback {
public function fetch_all(){
global $pdo;
$query = $pdo->prepare("SELECT * FROM comments");
$query->execute();
return $query->fetchAll();
} }
$feedback = new feedback;
$articles = $feedback->fetch_all();
?>
<html>
<body>
<?php foreach ($articles as $feedback) { ?>
<div class="comment" align="center">Name: <font size="3" color="grey"><?php echo $feedback['name']; ?></font> Email: <font size="3" color="grey">Hidden</font>
<br />
<font size="5" color="red"><div align="left"><?php echo $feedback['post']; ?></font></div></div>
<br><div class="divider2"> </div><br>
<?php } ?>
</html>
</body>
This displays all the comments that are listed in the comments field in mysql. each comment has a "cast" tab which displays the id of the podcast.
How can I get this to reflect the page being viewed?
for example.
if I'm viewing episode.php?id=1 then I want the comments with the "cast" tab of "1" to be displayed and not the "cast" tab of "2". Also the same goes for episode.php?id=2. and so on!
Please can someone guide me on how to do this?
thank you.
Kev