php - How would I color text inside echo while in a foreach loop? -


i'm new language, , question follows. so, have piece of code...

<?php echo "<table style='border: solid 1px black;'>"; echo "<tr><th><font color='green'><center>username</th><th><font color='green'><center>total exp</th><th><font color='green'><center>online time</th></tr>";  class tablerows extends recursiveiteratoriterator {     function __construct($it) {         parent::__construct($it, self::leaves_only);     }      function current() {         return "<td style='width:100px;border:1px solid black;'>" . parent::current(). "</td>";     }      function beginchildren() {         echo "<tr>";     }      function endchildren() {         echo "</tr>" . "\n";     } }  $servername = "localhost"; $username = "root"; $password = "123"; $dbname = "hiscores";  try {     $conn = new pdo("mysql:host=$servername;dbname=$dbname", $username, $password);     $conn->setattribute(pdo::attr_errmode, pdo::errmode_exception);     $stmt = $conn->prepare("select username, overall_xp, onlinetime hs_users order overall_xp desc limit 0, 10");     $stmt->execute();     // set resulting array associative     $result = $stmt->setfetchmode(pdo::fetch_assoc);      foreach(new tablerows(new recursivearrayiterator($stmt->fetchall())) $k=>$v) {          echo "$v";     } } catch(pdoexception $e) {     echo "error: " . $e->getmessage(); } $conn = null; echo "</table>"; ?>  

i want center, , make result white colored. i've tried multiple ways, still can't figure out how it.. me, please? i've tried adding font tags , stuff part

echo "$v";

nothing. outcome this

http://prntscr.com/7q50yi

seems may external file changing css.you can try !important each style like:

echo "<div style='color:#ffffff !important;text-align:center !important">$v</div>"; 

use <div> if eant each row in next line else can use <span>


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -