Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: array colors

  1. #1
    Regular Coder
    Join Date
    Jun 2010
    Location
    Sutton-in-ashfield, Notts
    Posts
    117
    Thanks
    7
    Thanked 0 Times in 0 Posts

    array colors

    I've got a news query while and i want the news article colors to be picked from

    This is what i have:
    PHP Code:
    $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 == ) { $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.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    PHP Code:
    $count=1;
    while( 
    $array mysql_fetch_assoc$query ) ) {
    echo 
    $j[$count];
    $count++;
    if( 
    $count == ) { $count 1; }

    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    Idfk (04-18-2012)

  • #3
    Regular Coder
    Join Date
    Jun 2010
    Location
    Sutton-in-ashfield, Notts
    Posts
    117
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Thankyou very much


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •