i wrote basic loop in php worked wanted, trying add link cannot syntax right , examples have found syntax not work me , keep getting errors. if show me going wrong amazing. thank in advance whether able or not!
the code throwing errors is
<a href=\"addcomment.php?id="'. $row['postid'] .'\">' "add comment" '</a>");
and full code is.
<?php include("connect.php"); //connect database //create query $get_messages_query = $db->prepare(" select * `blogposts` order `postid` desc limit 5 "); //homepage should have last 5 blog posts take //last 5 entered database , put them //array $get_messages_query->execute(); //executes query above while($row = $get_messages_query->fetch()) { $blog_post_history .= '<div class="post" id="post"> <h1>'. $row['title'] .' </h1> <h2>' . $row['author'] . '</h2> <p>'. $row['content'] . '</p> <a href=\"addcomment.php?id="'. $row['postid'] .'\">' "add comment" '</a>"); </div>'; } // while loop takes info db query , puts //information in own div title andauthor having //unique heading css p content of //the blog. loop puts information in //$blog_post_history called upon in div code //below ?>
there problem quotes around here
$blog_post_history .= '<div class="post" id="post"> <h1>'. $row['title'] .' </h1> <h2>' . $row['author'] . '</h2> <p>'. $row['content'] . '</p> <a href="addcomment.php?id='. $row['postid'] .'">add comment</a> </div>';
Comments
Post a Comment