Im currently creating a news blog and I want to show small clips of the blog and let the user click "Read More" if they want find out more info (see image below)
On the Read More button I have it linked like this.
<a href="http://<?php echo $_SERVER['SERVER_NAME']; ?>/notices/notice.php?id=<?=$image["id"] ?>">Read More</a>
Then on the notice.php page I'm trying to import the post in like this: (data base name is knollsnews)
<?php
$result = mysql_query("SELECT ID FROM knollsnews WHERE id='$id'");
while ($image=mysql_fetch_array($images))
{
?>
I'm not sure what I doing wrong here. The problem is that the post is not showing up on the notice.php page.
Here is the full code:
<?php
$result = mysql_query("SELECT ID FROM knollsnews WHERE id='$id'");
while ($image=mysql_fetch_array($images))
{
?>
<li data-id="id-<?=$image["id"] ?>">
<article class="postwhite">
<h2 style="margin: 10px 0 !important;"><?=$image["title"] ?></h2>
<img alt="<?=$image["title"] ?>" src="http://<?php echo $_SERVER['SERVER_NAME']; ?>/knolls_file_manager/source/NoticesImages/<?=$image["file_name"] ?>" class="img-max" title="<?=$image["title"] ?>">
<div class="newsdate" style="margin: 10px 0 !important;"><?= date("F d, Y", strtotime($image["date"])); ?></div>
<p class="articletext"><?=$image["description"] ?></p>
</article>
</li>
<?php
}
?>
Final Working CODE ON notice.php page
<?php
$id = (int) $_GET['id'];
$result = mysql_query("SELECT * FROM knollsnews WHERE id='$id'");
while ($image = mysql_fetch_array($result))
{
?>
<li data-id="id-<?=$image["id"] ?>">
<article class="postwhite">
<h2 style="margin: 10px 0 !important;"><?=$image["title"] ?></h2>
<img alt="<?=$image["title"] ?>" src="http://<?php echo $_SERVER['SERVER_NAME']; ?>/knolls_file_manager/source/NoticesImages/<?=$image["file_name"] ?>" class="img-max" title="<?=$image["title"] ?>">
<div class="newsdate" style="margin: 10px 0 !important;"><?= date("F d, Y", strtotime($image["date"])); ?></div>
<p class="articletext"><?=$image["description"] ?></p>
</article>
</li>
<?php
}
?>