Комментарий к каждому посту с использованием php.
<form action="" method="GET"> <?php $sql = mysqli_query($con, "select * from blogs"); while($row = mysqli_fetch_array($sql)){ echo '<img id="myImg" style="height: 400px; width: 800px; float: left;" src="pages/'.$row['url'].'" alt="'.$row['description']. '">'; echo '<br />'; echo '<p >'.$row['description']. '</p>'; echo '<br />'; echo '<br />'; echo '<br />'; $del = $row['id']; $sql1 = mysqli_query($con, "SELECT * FROM blog_comments WHERE id= '$del'"); while($row1 = mysqli_fetch_array($sql1)){ echo '<p> Posted by: ' .$row1['username'] .'<p>'; echo '<p> ' .$row1['comment'] .'<p>'; echo "<th><a href=\"blog.php?delete={$row1['user_id']}\">delete</a></th>"; echo '<br />'; }**echo '<form method="GET">'; echo '<input type="hidden" name="id" value="'.$row['id'].'">'; echo '<h2>Comments</h2>'; echo '<label>Username</label><br />'; echo '<input type="text" name="username">'; echo '<br />'; echo '<label>Comment :</label><br />'; echo '<textarea name="comment" id="comment" width="300px"></textarea><br />'; echo '<button name="submit1">Submit</button>'; echo '</form>'; } } ?> </form>
Что я уже пробовал:
Comment of each post using php. Hi i need help ? i just want to insert a comment on each post just like on facebook but i have problem on my code. im hardly analyzing code.. the process is the comment only it insert into the last post of my blog. is anybody knows how to insert comments into the desire post that i want to comment