title: How to display one banner ad every third row in php?
body: <p>Sorry for my English,</p>
  
  <p>I need to display a banner ad from a database every third row in php. Banner ads and rows with the classified are selecting from database. To this moment I create something like this:</p>
  
  <p><strong>Rows with the classifieds from database:</strong></p>
  
  <pre><code>while(@$row_select_kat = mysql_fetch_assoc($results_select_kat))
          {
              ... //classifieds from database
  
  
  
              if(($row_select_kat['id_ogloszenia']%3)==0)
              {
                  $lim = 1;
  
  
                  echo"&lt;div id=\"rek_poz_a\"&gt;";
                  modAddsDisplayHelper::wyswietlReklamyPozA();
                  echo"&lt;/div&gt;";
  
              }
          }
  </code></pre>
  
  <p><strong>Selecting banner ads from databes:</strong></p>
  
  <pre><code>public static function wyswietlReklamyPozA()
  {
      $baza_danych = &amp;JFactory::getDbo();
  
      $query_sel_all_banners = "SELECT * FROM juxhv_banners";
      $baza_danych-&gt;setQuery($query_sel_all_banners);
      $baza_danych-&gt;query();
  
      $banner_ads = $baza_danych-&gt;loadObjectList();
  
      echo$query_sel_all_banners;
      echo"Liczba x= ".$l_ogloszen;
  
      foreach($banner_ads as $banner_ad)
      {
          if($banner_ad-&gt;state==1)
          {
              echo"$banner_ad-&gt;name&lt;br/&gt;&lt;img src=\"images/$banner_ad-&gt;username/bannerwerbung/$banner_ad-&gt;zdjecie\" width=\"434px\" height=\"94px\" /&gt;";
          }
          else
          {
              echo"No banner";
          }
      }
  
  }
  </code></pre>
  
  <p>When I doing this in that way at every three rows displaying all three banner ads. How can I display only one banner ad every three rows?</p>
  
  <p>URL: <a href="http://www.nachbarhilft.de/" rel="nofollow">http://www.nachbarhilft.de</a></p>
  
  <p>Greetings</p>