Jump to content

how may else if's are you allowed to have?


nathanmaxsonadil

Recommended Posts

in some case like of your will be using a fix value to be conditioned like string or number

you can use the loop or switch like what akitchin said

 

something like

 

for($x=0;$x<=100;$x++)

{

  if($x==100) echo teng;

}

 

as you can see you dont have to have hundreds of lines to complete the test

my code is like this

if($_SESSION['loggedin'] == true) {
if($variable == function($varible)) {
//do something
}else if(function($variable) !== "" && $varible == "true") {
//do somthing
}else if(isset($varible) && $varible == 1) {
//do somthing
if (mysql_num_rows($result) == 0) {
//do somthing
}else
//do somthing
}
}else if(isset($varible2) && $varible2 == '1') {
//do somthing
if(mysql_num_rows($result) == 1) {
do somthing
}else if(mysql_num_rows($result) == 0) {
//do somthing
}else {
//do somthing if logged in but nothing matches above
}
}else {
//do somthing if not logged in 
}

however this code just display's a blank page :(

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.