-
PHP Color coding help
I need to have words flagged with color here is my code how can I have both failed and Cancelled show up red.
if($num_sched_adj > '0')
{
echo '</ul><table class="data">
<tr>
<th style="width:5%">SMS </th>
<th style="width:5%">Time </th>
<th style="width:40%">Group </th>
<th style="width:40%">Job </th>
<th style="width:10%">Status </th>
</tr>';
WHILE($row4 = MYSQL_FETCH_ARRAY($sched_adjresult))
{
$date_start = $row4['date_start'];
$ticket = $row4['ticket'];
$time_start = SUBSTR($row4['time_start'], 0, 5);
$group_Name = $row4['Group_Name'];
$job_Name = STR_REPLACE(',', '<br/>',$row4['Job_Name']);
$adjstatus = $row4['status'];
$altcolor = $altcolor == 'rowcolor2' ? 'rowcolor1' : 'rowcolor2';
$statuscolor = $adjstatus == 'Failed' ? '#C12603' : '#01C425';
$statuscolor = $adjstatus == 'Cancelled' ? '#C12603' : '#01C425';
echo '<tr class="'.$altcolor.'">
<td class="text_center">'.$ticket.'</td>
<td class="text_center">'.$time_start.'</td>
<td class="text_left">'.$group_Name.'</td>
<td class="text_left">'.$job_Name.'</td>
<td class="text_center" style="background-color:'.$statuscolor.'">'.$adjstatus.'</td>
</tr>';
}
echo '</table>';
fonrob
New php-forum User
Posts: 1
Joined: Tue Jan 08, 2013 6:52 am
-
Either use the logical OR operator to merge your two ternary statements or use, for example, something like http://php.net/manual/en/function.in-array.php
Also, your posts are much easier to read if you use punctuations and capitals to indicate where one sentence stops and the next begins and if you use
PHP Code:
<?php echo "colour coding in your code examples"; ?>
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
Bookmarks