display formatting with a while loop
| From: | olinux | Date: | Thu, 05 Apr 2001 09:47:28 +0000 |
| Subject: | display formatting with a while loop | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-8247@lists.php.net to get a copy of this message | ||
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