Page 1 of 1

Table problem

Posted: Thu Feb 25, 2010 3:56 am
by Jay87
I have the follwing table:

Code: Select all

                    if ($item['priority']==1)
                    {
                            echo "<tr [color=#FF0000]style=\"color:red;\"[/color] onclick=\"document.location='viewcall.php?id=" . $item['id'] . "&pfx=" . $item['id_prefix']; if($HTTP_SERVER_VARS['QUERY_STRING']){ echo "&";} echo $HTTP_SERVER_VARS['QUERY_STRING'] . "';\"><td class=smoothbg" . $stripe .">" . $item['id_prefix'] .  $item['id'] . "</td><td class=smoothbg" . $stripe .">" . substr($item['description'],0,75) . "</td><td class=smoothbg" . $stripe .">" . $days . "d&nbsp;" . $hours . "h&nbsp;" . $mins . "m&nbsp;</td><td class=smoothbg>" . $item['engineer'] . "</td><td class=smoothbg" . $stripe .">" . $item['company'] . "</td><td class=smoothbg" . $stripe ." style=\"color:red;\">" . $item['status'] . "</td></tr>";
                    } else {
                            echo "<tr onclick=\"document.location='viewcall.php?id=" . $item['id'] . "&pfx=" . $item['id_prefix']; if($HTTP_SERVER_VARS['QUERY_STRING']){ echo "&";} echo $HTTP_SERVER_VARS['QUERY_STRING'] . "';\"><td class=smoothbg" . $stripe .">" . $item['id_prefix'] .  $item['id'] . "</td><td class=smoothbg" . $stripe .">" . substr($item['description'],0,75) . "</td><td class=smoothbg" . $stripe .">" . $days . "d&nbsp;" . $hours . "h&nbsp;" . $mins . "m&nbsp;</td><td class=smoothbg style=\"color:black;\">" . $item['engineer'] . "</td><td class=smoothbg" . $stripe .">" . $item['company'] . "</td><td class=smoothbg" . $stripe ." style=\"color:black;\">" . $item['status'] . "</td></tr>";
                    }
which turns the row red if priority is 1 (high)

basically what i want to do is add:

Code: Select all

$item['notes']== $days<2
and if that is true make the row go green but keep priority calls red...

I can get them to work individually but not together....

Any ideas?

Re: Table problem

Posted: Thu Feb 25, 2010 7:08 am
by Jay87
I was thinking about an else if statement but wasn't sure?

Re: Table problem

Posted: Thu Feb 25, 2010 8:41 am
by AbraCadaver
That code is a mess. It would be easier to help if you indented and made it easier to follow.

Re: Table problem

Posted: Thu Feb 25, 2010 9:29 am
by Jay87
Sorry...

I got it to work (well half work) with...

Code: Select all

 
if  ($item['notes']== $days<2 && [color=#FF0000]$_SESSION['level']>2[/color])
{
     echo "blah.....";
}
elseif ($item['priority']==1 [color=#FF0000]&& $_SESSION['level']>2[/color]) 
{
     echo "blah2.....";
}
elseif ($_SESSION['level']>2)
{
     echo "blah3.....";
}
else 
{
     echo "blah4.....";
)
 
but i can't get the

Code: Select all

&& $_SESSION['level']>2
to work for some reason....

Does it need to be in brackets or something else?

Re: Table problem

Posted: Thu Feb 25, 2010 9:31 am
by Jay87
Scrap that, all they needed was brackets!!