...

View Full Version : array colors



Idfk
04-18-2012, 01:54 PM
I've got a news query while and i want the news article colors to be picked from

This is what i have:

$j[1] = "blue";
$j[2] = "yellow";
$j[3] = "purple";
$j[4] = "orange";
$j[5] = "green";

while( $array = mysql_fetch_assoc( $query ) ) {
echo "{$j}";
$j++;
if( $j == 6 ) { $j = 1; }
}

I want it to display them in that order aswell blue, yellow, purple, orange, green then back to blue.

Can anyone help? Thanks.

abduraooft
04-18-2012, 02:58 PM
$count=1;
while( $array = mysql_fetch_assoc( $query ) ) {
echo $j[$count];
$count++;
if( $count == 6 ) { $count = 1; }
}

Idfk
04-18-2012, 03:25 PM
Thankyou very much :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum