2 divs in while loop!

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

    2 divs in while loop!

    hello.,
    please guys how to print two defrant divs in while loop,
    example this pic
    Attached Files

    #2
    why not!
    PHP Code:
    while
    {
    echo 
    "<div class='text'><div class='title'>$abcd whatever</div>$efgh notever !</div>";

    Comment


      #3
      Originally posted by khan View Post
      while
      {
      echo*"<div*class='text'><div*class='title'>$abcd*w hatever</div>$efgh*notever*!</div>";
      }*
      But will it work??


      I'm Proud to be a Sri Lankan!

      Comment


        #4
        well i found it at another site so im decided to share it..
        PHP Code:
        <?php
        for($i=0;$i<5;$i++) {
        $post_bg = ($bg++%== 0) ? "black" "white";
        echo 
        "<div style='background-color: $post_bg'>text</div>";
        }
        ?>
        this printing
        text with black bg
        text with white bg
        if u will use it at while loop replace $i<5 to $i<1 ;)

        Comment


          #5
          $i=0;
          while(true)
          {
          if($i%2==0)
          {
          echo '<div class="a"></div>';
          }
          else
          {
          echo '<div class="b"></div>';
          }
          $i++;
          }

          Comment


            #6
            Use array brot

            Added after 6 minutes:

            This is easy

            if($css=="css1")
            {
            $css=="css2";
            }else{
            $css=="css1";
            }

            in the sql result

            echo "<div class=\"$css\">";
            echo "wathever<br/>";
            echo "</div>";
            Last edited by pichiriche; 01.07.11, 14:15.

            Comment


              #7
              There are unlimited choises for this where many of them are posted here, so just copy one that you like, Atef.
              mysterio.al - programming is a functional art

              Comment


                #8
                thank u guys..

                Comment

                Working...
                X