Skip to content Skip to sidebar Skip to footer

Display Check Or X Boolean In Table

I have atable in mysql database i'm fetching it to a html print '\n'; $result = $con->query($query); //return only the first row (we only need field names

Solution 1:

Try:

foreach ($rowas$name=>$value){
       if ($name == "Column 6"){
           if ($value == "0") {
               print"<td><span style='color: red;">X</span></td>\n";
           }
           else {
               print "<td>&#10004;</td>\n";
           }
       }
       else { 
           print"<td>$value</td>\n";
       }
     } // end field loop 

There's no good way to colorize checkboxes, unless you want to use some complex css. However you could try and utilize before and after CSS for checkboxes as shown here: CSS ''background-color" attribute not working on checkbox inside <div>

Post a Comment for "Display Check Or X Boolean In Table"