Hi :) I write some code for me and I need to compare two columns from different tables.
I have table blog_posts
with postID
and I have table blog_comment
with also have postID
.
I write something like this for start:
<?php
$stmt2 = $db->prepare('SELECT comment_sender_name, comment_date, comment
FROM blog_posts, blog_comment
WHERE blog_posts.psotID = blog_comment.postID');
$stmt2->execute(array(
':comment_sender_name' => $comment_sender_name,
':comment_date' => $comment_date,
':comment' => $comment
));
if ($row['blog_posts.psotID'] == $row['blog_comment.postID']) {
echo '<p>' . $comment_sender_name . '</p>';
echo '<p>' . $comment_date . '</p>';
echo '<p>' . $comment . '</p>';
} else ($row['blog_posts.psotID'] == '') {
header('Location: ./');
exit;
}
?>
And this is the error I get :
Parse error: syntax error, unexpected '{' in /home/pomarex1/domains/dev.automax-rent.eu/public_html/comments-loop.php on line 12