Table problem

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

Table problem

Post 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?
Jay87
Forum Commoner
Posts: 61
Joined: Thu Jan 07, 2010 5:22 am

Re: Table problem

Post by Jay87 »

I was thinking about an else if statement but wasn't sure?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Table problem

Post by AbraCadaver »

That code is a mess. It would be easier to help if you indented and made it easier to follow.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Jay87
Forum Commoner
Posts: 61
Joined: Thu Jan 07, 2010 5:22 am

Re: Table problem

Post 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?
Jay87
Forum Commoner
Posts: 61
Joined: Thu Jan 07, 2010 5:22 am

Re: Table problem

Post by Jay87 »

Scrap that, all they needed was brackets!!
Post Reply