I have two pages like a general blog articles have, 1 page as small preview of articles and 1 page with full article. Each small preview article has a button called "Read More" and when the user clicks it the all article opens in a separate page. I am uploading the articles with columns id, name, author, title, article and date. On page 1, the preview of all the article are retrieving from the database perfectly but the "READ MORE" button is not working perfectly. When clicked on "Read More" of any article preview, only the first article is showing up instead of different articles according to the previews.
Here is the code
Page 1 (preview page)
<?php
$db = mysqli_connect("localhost", "root", "", "myblogs.com");
$sql = "SELECT * FROM blogs";
$result = mysqli_query ($db, $sql);
while ($row = mysqli_fetch_array($result)){
echo " <div class='date-posts'>
<a href='index.php'>".$row['title']."</a></h1>
</div>
<div>".$row['author']."</div>
<div><img src='blogs/".$row['image']."'><div class='blogsampletext'>".$row['article']."</div>
<a href='page2.php.'>Read More</a>
</div>
";
}
?>
Page 2 (where full article text is shown)
<?php
$db = mysqli_connect("localhost", "root", "", "myblogs.com");
$sql = "SELECT * FROM blogs LIMIT 1";
$result = mysqli_query ($db, $sql);
while ($row = mysqli_fetch_array($result)){
echo "<tr><td colspan='2' align='center'><h2>".$row['title']."</h2><br>
<img src='blogs/".$row['image']."'><br>
<h4>".$row['author']."</h4>
</td></tr>";
echo "<tr><td colspan='2'><hr>".$row['article']."</td></tr>";
}
?>