473,387 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Display database values in different colours

250 100+
In my web page there is a table for displaying database values. For one column displays connected or Disconnected. If the database values is Disconnected i want to display the value in red color. How can i do that? This is my existing code.

[PHP]<td width="121" class="IDTableCell"><?php "$StationID" ;?> </td>[/PHP]
Jun 11 '08 #1
2 1527
Markus
6,050 Expert 4TB
You'd need to somehow determine whether it's d/c or connected. So best way would be to store a value in your database (0 = d/c, 1 = connected).

[php]
if($status == 1)
echo "<td width=\"121\" style=\"color: green;\" class=\"IDTableCell\">$StationID</td>";
else
echo "<td width=\"121\" style=\"color: red;\" class=\"IDTableCell\">$StationID</td>";
[/php]
Jun 11 '08 #2
r035198x
13,262 8TB
You'd need to somehow determine whether it's d/c or connected. So best way would be to store a value in your database (0 = d/c, 1 = connected).

[php]
if($status == 1)
echo "<td width=\"121\" style=\"color: green;\" class=\"IDTableCell\">$StationID</td>";
else
echo "<td width=\"121\" style=\"color: red;\" class=\"IDTableCell\">$StationID</td>";
[/php]
If you store the color in a variable, you make the coding shorter and cleaner.
Jun 11 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: pathisunil | last post by:
Dear All I have an xmldocument which is as formed below. It is a bit of loopy in nature. can anyone kindly let me know how can i write a xslt which would take a parameter which is an attribute...
4
by: David Ehmer | last post by:
I have some buttons I'm working on at this address http://www.boatingaccessories.com.au/test3.htm In NS7, Mozilla and Opera, the borders don't render. IE6 displays as intended. Appreciate...
9
by: Big Slim | last post by:
I'm working on a web application that makes heavy use of CSS, but I would like users to have a degree of control over some of the classes and attributes. To accomplish this, I want to store my CSS...
2
by: dcinfinite | last post by:
hi everyone.. i have a situation, there are two drop down list, 1)Car Model 2) Car Colours. A set of specific colours would fill up the second dropdown list based on the Car Model choosen on the...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
0
by: pathisunil | last post by:
Dear All I have an xmldocument which is as formed below. It is a bit of loopy in nature. can anyone kindly let me know how can i write a xslt which would take a parameter which is an...
11
by: Andante.in.Blue | last post by:
A recent change in the user interface of one of the tech forums I frequent prompted furious debates in the areas of functionality versus look'n'feel of professional applications. This has made me...
2
by: assgar | last post by:
Hi Developemnt on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. I use 2 scripts(form and process). The form displays multiple dynamic rows with chechboxs,...
2
by: Jassim Rahma | last post by:
what's the best way to store and retrieve colors from a database? string or RGB values or...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.