How to display the content in the database in different colors on the page

Source: Internet
Author: User
How to display the content in the database in different colors on the page? As the question. For example, under Database database1, a table named table1 has seven columns with values 0, 1, or 2. how can I display this table on the network, and it must be red when the value is 0; yellow when the value is 1; green when the value is 2 ??? ------ Solution ----------------- how to display the content in the database in different colors on the page?
As the question. For example, under Database database1, a table named table1 has seven columns with values 0, 1, or 2. how can I display this table on the network, and it must be red when the value is 0; yellow when the value is 1; green when the value is 2 ???


------ Solution --------------------
Set a style sheet
------ Solution --------------------

$ Style = array (0 => "red", 1 => "yellow", 2 => "gree ");
Output style based on database values



------ Solution --------------------
Will PHP output tables? Similar

$ar1=array(0,1,2);
$ar2=array(0,1,2);
$ar3=array(0,1,2);
$ar4=array(0,1,2);
$ar5=array(0,1,2);
$ar6=array(0,1,2);
$ar7=array(0,1,2);








for($i=0;$iecho " ";echo " ";echo " ";echo " ";}
".$ar1[$i]."".$ar2[$i]."



Assume that the output table is in the following format:


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.