I am trying to increase font size and add a blue background to first cell, but I could not manage it.
// sending query
$result = mysql_query("SELECT `UserName`,`UserScore` FROM {$table} ORDER BY `UserScore` DESC");
if (!$result) {
die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
echo "<table border='1' align='center'><tr>";
// printing table headers
//for($i=0; $i<$fields_num; $i++)
//{
// $field = mysql_fetch_field($result);
echo "<td>Name </td>";
echo "<td>Score </td>";
//}
echo "</tr>
";
// printing table rows
while($row = mysql_fetch_row($result))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo "<td>$cell</td>";
echo "</tr>
";
}
mysql_free_result($result);
How can I increase font size and add a blue background to first cell in above table?
Hope this Helps!
<?php
$result = mysql_query("SELECT `UserName`,`UserScore` FROM {$table} ORDER BY `UserScore` DESC");
if (!$result) {
die("Query to show fields from table failed");
}
$fields_num = mysql_num_fields($result);
echo "<table border='1' align='center'><tr>";
// printing table headers
//for($i=0; $i<$fields_num; $i++)
//{
// $field = mysql_fetch_field($result);
echo "<td>Name </td>";
echo "<td>Score </td>";
//}
echo "</tr>
";
// printing table rows
while($row = mysql_fetch_row($result))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
$i = 0;
foreach($row as $cell)
{
if($i == 0)
$class = "class = 'backg'";
else
$class = "class = ''";
echo "<td ".$class.">$cell</td>";
$i++;
}
echo "</tr>
";
}
mysql_free_result($result);
?>
Styles here
<style>
.backg{background:blue;font-size:18px;}
</style>