php - List of highest scores- how to differentiate your score in the list -
i working on simple game.
when user view scores of users want score in different color. how can it?
so far have list of scores highest score lowest
mysql_connect("$host", "$username", "$password")or die("cannot connect server "); mysql_select_db("$db_name")or die("cannot select db"); $sql="select * $tbl_name order score desc;"; $result=mysql_query($sql); while($rows=mysql_fetch_array($result)){ ?> <html table> <?php } mysql_close(); ?>
test whether player in row current player, , set class. use css assign color class.
while ($row = mysql_fetch_assoc($result)) { $class = $row['player'] == $current_player ? 'class="highlight"' : ''; echo "<tr $class>"; // code rest of table row echo "</tr>"; }
Comments
Post a Comment