Code: Select all
$query = "SELECT id, title, timestamp, type FROM news ORDER BY timestamp DESC LIMIT 0, 7";
$result = mysql_query($query) or die ("Error in query: $query . " . mysql_error());
// if records present
if (mysql_num_rows($result) > 0)
{
//iterate through resultset
// print article titles
while($row = mysql_fetch_object($result))
{
?>
</p>
<?php
$type = $row->type;
$id = $row->id;
$title = $row->title;
$timestamp = formatDate($row->timestamp);
if (($id+1) != $row->id){
echo "NEW! ";
}(the rest of the code simply prints the titles and dates of the news, and i didnt see a reason to post it, but that is why the code is still open)