First of all thanks for the help. Great forums and I learn so much every day.
Heres what Ive been working on the following, my first goal for this particular project was to make my table rows alternate colors. This was easy enough using examples found on the internet. I nailed it down in no time.
Now I wish to change the text color based on the status ID from my query. Lets start with my first bit of code for alternating the table colors.
<?php
echo ' <table width="100%" cellpadding="0" cellspacing="0" summary="">';
// Define my background colors
$row1 = '<tr class="row2">';
$row2 = '<tr class="row">';
$row_count = 0;
// do the query:
$orders_contents = '';
$orders_status = $db->Execute("select orders_status_name, orders_status_id from " . TABLE_ORDERS_STATUS . " where language_id = '" . $_SESSION['languages_id'] . "'");
while (!$orders_status->EOF) {
$orders_pending = $db->Execute("select count(*) as count from " . TABLE_ORDERS . " where orders_status = '" . $orders_status->fields['orders_status_id'] . "'");
/* Now we do this small line which is basically going to tell PHP to alternate the colors between the two colors we defined above. */
$row_color = ($row_count % 2) ? $row1 : $row2;
$orders_contents .= $row_color . '<td class="rowLeft"><a href="' . zen_href_link(FILENAME_ORDERS, 'selected_box=customers&status=' . $orders_status->fields['orders_status_id'], 'NONSSL') . '">' . $orders_status->fields['orders_status_name'] . '</a>:</td><td class="rowRight"> ' . $orders_pending->fields['count'] . '</td><td class="rowRight">' . 'test'. '</td></tr>';
$orders_status->MoveNext();
$row_count++;
}
echo $orders_contents;
echo ' </table>';
?>
Now I was thinking I can use the same concept to change my text color based on the orders_status_id. So that I can say if the order_status_id = 2 then my <td class="rowRightGreen"> or something similar to change the style of the text to whatever I want.
My question is in what way should/could i go about doing this. My initial thoughts would be to base it off my previous modifcation for row colors. Exept instead of defining a $row_color = ($row_count % 2) ? $row1 : $row2; make an additional variable that is defined by the order_status_id.
Any ideas how I can do this?
Thanks so much guys.