查询select * from table limit 0,100,为每个(偶数限制)echo回显一些东西

i have a database wherein i echo anything i want but i want to echo something else every time the code echos 2 things. I actually tried foreach() function but im actually quite confused on how to use it with this kind of situation

here's an example:

$sql = "SELECT * FROM table ORDER BY ID DESC LIMIT 0, 100";
$rs = mysql_query($android_app_sort,$con);
while($row = mysql_fetch_assoc($android_app_q_sort))
        {
          echo $row['ID'];

          <--FOR EVERY 2 echos's then ECHO SOMETHING-->
        }

all help is appreciated

Like this:

for( $i = 0; $row = mysql_fetch_assoc($android_app_q_sort); $i++ ) {

  if( ( $i % 2 ) == 0 ) {
    print "Even row."
  }

}
$sql = "SELECT * FROM table ORDER BY ID DESC LIMIT 0, 100";
$rs = mysql_query($android_app_sort,$con);
$iterator = 0;
while($row = mysql_fetch_assoc($android_app_q_sort))
    {
      $iterator++;
      if($iterator%3 == 0) {echo 'something';}
      echo $row['ID'];
    }

use simple modulo operation, this will print every third row something.

You can use like below code

$i=0;
while($row = mysql_fetch_assoc($android_app_q_sort))
{
          if($i%2 == 0)
          { 
             echo $row['ID'];
          }         
          $i++;
}