Why doesn't it prevent further looping?
<p>My code does not seem to stop after 6 and 2 iterations - why is this? I do not want more than 6 values displayed from services, and 2 values from cultures.</p>

<pre><code>ECHO "&lt;fieldset&gt;Services: ";
$servicearray = mysql_query("select serv_id from org_serv_xref where org_id='".$org_id."'");
while ($servicearrayrow = mysql_fetch_array($servicearray)) {
    $servdescarray = mysql_query("select serv_desc from service where serv_id='".$servicearrayrow['serv_id']."'");
    $i = 0;
    while ($servdescarrayrow = mysql_fetch_array($servdescarray)) {
        if ($i &lt; 6) {
            ECHO $servdescarrayrow['serv_desc']." ";
            $i++;
        }
        else {
            break;
        }
    }
}
ECHO "&lt;/fieldset&gt;";
ECHO "&lt;fieldset&gt;Cultures: ";
$culturearray = mysql_query("select cult_id from org_cult_xref where org_id='".$org_id."'");
while ($culturearrayrow = mysql_fetch_array($culturearray)) {
    $cultdescarray = mysql_query("select cult_desc from culture where cult_id='".$culturearrayrow['cult_id']."'");
    $i = 0;
    while ($cultdescarrayrow = mysql_fetch_array($cultdescarray)) {
        if ($i &lt; 2) {
            ECHO $cultdescarrayrow['cult_desc']." ";
            $i++;
        }
        else {
            break;
        }
    }
}
ECHO "&lt;/fieldset&gt;";
</code></pre>
