Hi
I am trying to get it so the page displays the date, title and news for the last 3 records in the database I have setup, also make the date and title a link to the actual news article page.
This is what I have tried but its no good anybody tell me where I have gone wrong with this please, the coding in this file gets pulled into the page using an include.
[code=php]
<div id=”panel-right” class=”box panel”>
<div class=”in”>
<h3>Driving Insructor<br /> Latest News</h3>
<?php
$result = mysql_query(SELECT * FROM news ORDER BY id DESC LIMIT 0,3);
while($r=mysql_fetch_array($result))
{
$date=$r[‘date’];
$title=$r[‘title’];
$news=$r[‘news’];
$id=$r[‘id’];
$address = “$title/$id”;
$url = str_replace(‘ ‘,’-‘,$address);
//make the title a link
echo “<li>”;
echo “<a href=’news_article/$url’)’>$date : $title</a>”;
echo “<p>” . substr($r[‘news’], 0, 400) . “</p>”;
echo “</li>”;
}
?>
<p><a href=”dual_control_car_hire/latest_news.php”>All News</a></p>
</div>
</div>