lil help plz about auto color

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    lil help plz about auto color

    okay i know that title of this topic is not explaining what i want so ill try explain it bellow

    if i have this code on page (its not the whole code but ull get what i want)
    PHP Code:
    while ($what mysql_fetch_array($bla))
        {
         echo 
    "<div class=\"links\"><a href=\"video.php?id=$what[0]\">".htmlspecialchars($what[3])."</a></div><br/>";
        } 
    so on the page this will put all the links one after another...
    which is okay, i want that lol
    but i also want every 2nd background to be another color!

    example:
    PHP Code:
    1st link BLACK BACKGROUND color
    2nd link WHITE BACKGROUND color
    3rd link BLACK BACKGROUND color
    4th link WHITE BACKGROUND color 
    i hope u understand what i want and i would be greatful 4 any help
    sigpiceeeeerrr....

    #2
    here is a visual example what i want



    you c every 2nd background of chat msg is another color....
    sigpiceeeeerrr....

    Comment


      #3
      Originally posted by alesh View Post
      okay i know that title of this topic is not explaining what i want so ill try explain it bellow

      if i have this code on page (its not the whole code but ull get what i want)
      PHP Code:
      while ($what mysql_fetch_array($bla))
          {
           echo 
      "<div class=\"links\"><a href=\"video.php?id=$what[0]\">".htmlspecialchars($what[3])."</a></div><br/>";
          } 
      so on the page this will put all the links one after another...
      which is okay, i want that lol
      but i also want every 2nd background to be another color!

      example:
      PHP Code:
      1st link BLACK BACKGROUND color
      2nd link WHITE BACKGROUND color
      3rd link BLACK BACKGROUND color
      4th link WHITE BACKGROUND color 
      i hope u understand what i want and i would be greatful 4 any help
      it is easy to do
      Code:
      while ($what = mysql_fetch_array($bla))
          {
            $I++;
            if(is_integer($I / 2)) $row = "<div class='iblock'>"; else $row = "<div>";
            echo"$row";
           echo "<div class=\"links\"><a href=\"video.php?id=$what[0]\">".htmlspecialchars($what[3])."</a></div><br/>";
           echo'</div>';
          }
      Last edited by Anshul; 16.03.09, 15:58.

      Comment


        #4
        thanX
        workS fiiiiiine!!!!
        Last edited by alesh; 16.03.09, 17:20.
        sigpiceeeeerrr....

        Comment

        Working...
        X