Re: display formatting with a while loop

From: Date: Thu, 05 Apr 2001 16:54:44 +0000
Subject: Re: display formatting with a while loop
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-8281@lists.php.net to get a copy of this message
looks like you could load the desired variables in an array($y,$x) where $y ranges from 0 to 3.. then you could echo the 4 rows walking through array(0,$x), array(1,$x), etc..... "olinux" <olnx@yahoo.com> schrieb in im Newsbeitrag: 000a01c0bdb6$7ec21500$6401a8c0@amdk7... > what if i put the if statements inside of another if statement and then set > the $i back to 1. > > if ($1 = 4) { > $display .= "</td><td>"; > $i = 1; > } > > how exactly would i do this, or is it totally wrong? > > olinux > > > ----- Original Message ----- > From: "olinux" <olnx@yahoo.com> > To: "PHP-DB" <php-db@lists.php.net>; <PHPLearners@yahoogroups.com> > Sent: Thursday, April 05, 2001 2:47 AM > Subject: [PHP-DB] display formatting with a while loop > > > hey all, > well, i dont know that a while loop will be my solution, i think that it > may. What i would like to do is to display 4 variables and then create > another column. the toughy is that i an using a series of IF'f inside the > while. > > So something like this: > > while ($1 < 4) { > if ($var1 == 1) > > $display .= "<br>variable one is true"; > $i++; > } > if ($var2 == 1) > > $display .= "<br>variable two is true"; > $i++; > } > if ($var3 == 1) > > $display .= "<br>variable three is true"; > $i++; > } > if ($var4 == 1) > > $display .= "<br>variable four is true"; > $i++; > } > if ($var5 == 1) > > $display .= "<br>variable five is true"; > $i++; > } > } > > So ideally instead of getting this (in the browser): > > variable one is true > variable two is true > variable three is true > variable four is true > variable five is true > > we would see : > > variable one is true | variable five is true > variable two is true | > variable three is true | > variable four is true | > > I know that i need to put int a </td><td> between every fourth variable that > is printed [cuz if they dont equal 1 they do not print anything] > > My problem is, i do not know how to get these inserted. I have about 15 > fields so i would like to be able to display them in table cells of 4 or 5 > each. > > Thank you, > > olinux > > > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#8281) next »