drew, thanks.
What do I need to include in the <td> tags, if anything, to make sure the bgcolor is there, anything?
Here's the complete code I use to display the information.
<?
// includes
include("conf.php");
// open database connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
$query = "SELECT newsID, news_headline, date_format(news_date, '%c.%d.%y')as news_date FROM news ORDER BY newsID 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))
{
if ($i % 2 == 0) {
#cccccc
} else {
#ffffff
}
$i++;
?>
<tr>
<td><a href="/news.php?newsID=<?php echo $row->newsID; ?>" class="link-news"><? echo $row->news_headline; ?></a></b><font class="text-date"> [<? echo $row->news_date; ?>]</font></td>
</tr>
<?
}
}
// if no records present
else
{
?>
<font size="-1">no news items currently available</font>
<?
}
// close database connection
mysql_close($connection);
?>
Am I right, or close?