Else If

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jay87
Forum Commoner
Posts: 61
Joined: Thu Jan 07, 2010 5:22 am

Else If

Post by Jay87 »

I have the following else if statement (i edited out most of the echo):

Code: Select all

if     ($days>2 && ($item['statusid']<2) && ($_SESSION['level']>2)) [color=#FF0000]{[/color]
         echo "<tr  style=\"color:green;\".............
[color=#FF0000]}[/color] elseif ((($date2-$date1)/60)>-15 && $item['date']==NULL)  [color=#FF8000]{[/color] 
     echo "<tr  style=\"color:orange;\".............
[color=#FF8000]}[/color] elseif ($item['priority']==1 && ($_SESSION['level']>2)) [color=#FF0000]{[/color]
     echo "<tr  style=\"color:red;\".............
[color=#FF0000]}[/color] elseif ($item['statusid']==15 && ($_SESSION['level']>2)) [color=#FF0000]{[/color]
    echo "<tr onclick=\"document.location='viewcall.php?id=".............
[color=#FF0000]}[/color] elseif ($_SESSION['level']>2) [color=#FF8000]{[/color]
    echo "<tr onclick=\"document.location='viewcall.php?id=".............
[color=#FF8000]}[/color] else   [color=#FF0000]{[/color]
    echo "<tr onclick=\"document.location='viewcall.php?id="............
[color=#FF0000]}[/color]
I am unsure about the brackets used in the statement i.e.

Code: Select all

if     [color=#FF0000]([/color]$days>2 && [color=#0000FF]([/color]$item['statusid']<2[color=#0000FF])[/color] && [color=#008000]([/color]$_SESSION['level']>2[color=#008000])[/color][color=#FF0000])[/color]
As the code runs but not exactly as it should but doesn't stop the page from loading...

Am i using the brackets right in the Else If statement?
Jay87
Forum Commoner
Posts: 61
Joined: Thu Jan 07, 2010 5:22 am

Re: Else If

Post by Jay87 »

Anyone?
jraede
Forum Contributor
Posts: 254
Joined: Tue Feb 16, 2010 5:39 pm

Re: Else If

Post by jraede »

I don't see where you're trying to stop the page from loading...? The code looks like it should work.
Post Reply