Hi,
Im new in this programming world. Here is my problem: I need to display result of which I need to show location and gred using colors. For example for total staff the color will be blue and green color for available post. Below is my coding but it will only display a list of location and position for each location. How do I do it in php? How do I calculate number of staff and put the result in table which will show in blue color?
Below is my code:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html><?php
//connect database
$con = mysql_connect("localhost","root");
if(!$con)
{
die('Could not connect: ' . mysql_error());
}
//select database to be use
mysql_select_db("mpchr", $con);
// query the database table
$sql = "SELECT Floor_Location, GRED_ID FROM STAFF ";
//run the query againts the mysql function
$result=mysql_query($sql);
echo "<table border='1'>
<tr>
<th>\n\n\nLokasi</th>
<th>\n\n\n\n\n\n\n\n\n\n\n\nJawatan</th>
</tr>";
//ceate while loop and loop through result set
while ($row = mysql_fetch_array ($result))
{
$Floor_Location= $row ['Floor_Location'];
$Gred_ID = $row [ 'GRED_ID'];
//display the result of the array
echo "<tr>";
echo "<td> " . $row['Floor_Location'] . "</td>";
echo "<td>" . $row['GRED_ID'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
Appreciate with any help frm you guys.