# Stop after number

**URL:** <https://forum.kirupa.com/t/stop-after-number/191494>\
**Category:** Uncategorized\
**Created:** [June 20, 2006, 11:52pm UTC](https://forum.kirupa.com/t/stop-after-number/191494 "2006-06-20T23:52:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![james182](https://avatars.discourse-cdn.com/v4/letter/j/278dde/32.png) [@james182](https://forum.kirupa.com/u/james182)\
**Post date:** [June 20, 2006, 11:52pm UTC](https://forum.kirupa.com/t/stop-after-number/191494/1 "2006-06-20T23:52:08Z")

</div>

the problem with my script is when it gets to the end number i.e 13 it then starts all over again from 1. how do i stop it at the end number i.e. 13.

```php

<table width="700" cellpadding="0" cellspacing="0" border="0">
          	<?php
          	include ("connect.php");
    $result = mysql_query("select * from table WHERE visible='yes' ORDER BY sequence ASC");
          	    $counts = mysql_num_rows($result);
          		
          		
          		$count = 1;
          	    while($r=mysql_fetch_array($result)){
          		   $category=$r["category"];
          		   $imghome=$r["imghome"];
          		   $sequence=$r['sequence'];
          		   $catid=$r["catid"];
          	?>
        <? for($i = 1; $i <=$counts; $i++){ ?>
          		<td width="200" align="left">
          			<? if($counts = $counts){?>
          			<?}else{?>
          			flashtitle<?=$i?><br>
          			<?}?>
          		</td>
                    <?php
                    if ($count == 3) {
                      echo "</tr>
<tr>
";
          			    $count = 0;    
          			          }
          			    $count++;
          			}
                    ?>
          		  <?}?>
              </tr>
          </table>

```
