PHP Color coding help

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Tue Jan 08, 2013 6:52 am

PHP Color coding help

Postby fonrob » Tue Jan 08, 2013 6:57 am

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">
<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>

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>

echo '</table>';

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 4 guests