loserWILL
07-03-2008, 03:31 AM
I'm stuck!
I'm just coding the frontend of my new site and I've hit my first error.
I want my news articles to alternate between three header colours. I can't do it, the colours alternate correct but three of each article comes out.
How would I make the colours alternate like that (green, blue, orange_ but only have one of each article come up?
Here's the code I'm using:
<?php
include "config.php";
$check = mysql_query("SELECT title, author, content, date FROM news ORDER BY id DESC LIMIT 0, 5") or die("nothing to display at the moment.");
while ($display = mysql_fetch_array($check)) {
$title = $display['title'];
$author = $display['author'];
$content = $display['content'];
$date = $display['date'];
echo "<h1>$title - by $author</h1>
$content<br />
<i>Posted on $date</i>
<h2>$title - by $author</h2>
$content<br />
<i>Posted on $date</i>
<h3>$title - by $author</h3>
$content<br />
<i>Posted on $date</i>";
}
?>
+rep to all help.
I'm just coding the frontend of my new site and I've hit my first error.
I want my news articles to alternate between three header colours. I can't do it, the colours alternate correct but three of each article comes out.
How would I make the colours alternate like that (green, blue, orange_ but only have one of each article come up?
Here's the code I'm using:
<?php
include "config.php";
$check = mysql_query("SELECT title, author, content, date FROM news ORDER BY id DESC LIMIT 0, 5") or die("nothing to display at the moment.");
while ($display = mysql_fetch_array($check)) {
$title = $display['title'];
$author = $display['author'];
$content = $display['content'];
$date = $display['date'];
echo "<h1>$title - by $author</h1>
$content<br />
<i>Posted on $date</i>
<h2>$title - by $author</h2>
$content<br />
<i>Posted on $date</i>
<h3>$title - by $author</h3>
$content<br />
<i>Posted on $date</i>";
}
?>
+rep to all help.