Re: [PHP] hrm..loop trouble

2001-09-19 Thread Philip Olson

Modulus will come in handy here, here's an example use :
 
 
  
". $row['foo'] ."\n";
 
  if (($i++ % 5) === 4) {
echo "\n\n";
  }
}

?>
  
 


Regards,
Philip Olson

On Wed, 19 Sep 2001, Kurth Bemis wrote:

> i'm trying to get a chunk of code to look 5 times then print 
> something..then look 5 time more
> 
> I really want to loop 5 times (making 5 cells) then print then 
> loop 5 more times for 5 cells...until the count is reachedlike if i 
> have 22 things i want to have 4 rows of five and one row of two...get what 
> i'm trying to do?
> 
> heres the code that i have so far
> 
>while ($arraycnt <= (count ($typearray)-1)){
>   $type = $typearray[$arraycnt]; //grab a first chair in array
>   
>   $sqlquery = "SELECT * FROM chairs WHERE type = '$type'";  //construct 
>sql 
> query
>   $result=mysql_query($sqlquery,$db);
>   
>   while ($tempcnt <= 5){
>   print "";
>   while ($myrow = mysql_fetch_array($result)) {
>   print " src=\"/img/thumbs/".$myrow[modelnum]."_1.gif\" border=\"0\" 
> alt=\"\">Model $myrow[modelnum]";
>   } //close cell loop
>   $tempcnt++;
>   print "";
>   } //close second while loop
>   $arraycnt++;
>   } //close first while loop
> ?>
> 
> look at http://www.strawhillchairs.com/cat/index.php
> 
> to see what i'm trying to do
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] hrm..loop trouble

2001-09-19 Thread Kurth Bemis

i'm trying to get a chunk of code to look 5 times then print 
something..then look 5 time more

I really want to loop 5 times (making 5 cells) then print then 
loop 5 more times for 5 cells...until the count is reachedlike if i 
have 22 things i want to have 4 rows of five and one row of two...get what 
i'm trying to do?

heres the code that i have so far

";
while ($myrow = mysql_fetch_array($result)) {
print "Model $myrow[modelnum]";
} //close cell loop
$tempcnt++;
print "";
} //close second while loop
$arraycnt++;
} //close first while loop
?>

look at http://www.strawhillchairs.com/cat/index.php

to see what i'm trying to do


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]