Why does my SELECT query not work? I know there are multiple ways to cut down the pdo query code but I wanted to use the longer version in hope that I would find the problem. The $CommentID
when echoed is displaying the right ID but the variables do not get populated with the corresponding data.
<?php
$CommentID = $_GET['id'];
$ViewQuery = $pdo->prepare('SELECT * FROM comments WHERE id=:id');
$ViewQuery->bindParam(":id",$CommentID);
$ViewQuery->execute();
$comment = $ViewQuery->fetch();
$DateTime=$comment['datetime'];
$ComName=$comment['name'];
$Email=$comment['email'];
$Comment=$comment['comment'];
$PostID=$comment['admin_panel_id'];
?>
I have looked at multiple similar questions but they all have syntax error and I don't think that's the case here, maybe it is, I just don't see it.