Re: while....for....problem

From: Date: Mon, 19 May 2003 20:29:01 +0000
Subject: Re: while....for....problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148201@lists.php.net to get a copy of this message
Simon <velikanka@hotmail.com> wrote in message news:20030519130110.98345.qmail@pb1.pair.com... I have replace 'for' with another 'while'. So the code looks like: it is working now as I wanted, but I dont know why it didn't work with 'for' :( > <?php > $query = "SELECT number FROM table"; > $result = mysql_query($query) or die ("Error in query: $query. " . > mysql_error()); > while($row = mysql_fetch_object($result)) { > $number= $row->number; > ?> > some html > <?php > $e=($number+1)/15; > $c=ceil($e); while ($i >= 1 and $i <= $c): $d=($i-1)*15; > ?> > <a href="link.php?offsef=<?=$d;?>"><?=$i;?></a> > <? $i++; endwhile; > ?> > some html > <? > } > ?> > > Problem is in the 'For' part. It doesn't print all '$i', only for the first > while loop. > > TNX > >

« previous php.general (#148201) next »