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 "
".$ar1[$i]." | ";echo "
".$ar2[$i]." | ";echo "
";}
Assume that the output table is in the following format: