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" <[EMAIL PROTECTED]>
To: "PHP-DB" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to