I am trying to modify an existing web page we use at our facility to monitor mill performance. I thought that what I wanted to do was simple but is proving to be a pain. If $result is greater than 15, for a specific parameter, I want the displayed value text on the webpage to change colors. <15 = green. >= 15 = red.
The site author didn’t use css so I am trying to incorporate into the echo statement. See my changes in RED below please:
"); // db connector $stmt = "SELECT TOP 1 * FROM NDT_OEE ORDER BY ID DESC"; // sql select cmd $result = odbc_exec($db, $stmt); if ($result == FALSE) die ("could not execute statement $stmt
"); // error message echo "
| TIME | AVAILABILITY % | PERFORMANCE % | OEE % | DOWNTIME | PROD. COUNT | PROVEUP % | "; while (odbc_fetch_row($result)){ echo "|
|---|---|---|---|---|---|---|---|
| " . odbc_result($result, "DATE_TIME"); echo " | " . odbc_result($result, "REALTIME_AVAILABILITY"); echo " | " . odbc_result($result, "REALTIME_PERFORMANCE"); echo " | " . odbc_result($result, "REALTIME_OEE"); echo " | " . odbc_result($result, "REALTIME_DOWNTIME"); echo " | " . odbc_result($result, "REALTIME_PRODUCTION_COUNT"); [u][i][b]if ($result["REALTIME_PROVEUP_RATE"] < "15"){ echo " | " . odbc_result($result, "REALTIME_PROVEUP_RATE"); } else { echo " |
" . odbc_result($result, "REALTIME_PROVEUP_RATE");
}}[/b][/i][/u]
odbc_free_result($result);
odbc_close($db);
?>
It is querying from SQL and displays the data perfectly. The displayed value is always ‘green’ now and I cant seem to see the problem. Any advice or help would be greatly appreciated. |