Can anyone tell me how I can format the last row of my table as currency with two decimal places? I researched it online first but everything I tried came up with errors. I think that it's the way that I'm outputting my table. My code is below. Thank you very much.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Upcoming Tournaments</title>
</head>
<body>
<?php include("menu.php"); ?>
<br />
<?php
// set database server access variables:
$host = "hostName";
$user = "test";
$pass = "test";
$db = "test";
// open connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
// create query
$query = "SELECT TournamentID, tournyName, DATE_FORMAT(tournyDate,'%m-%d-%Y'), Location, Purse, EntryFee
FROM Tournament";
// execute query
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
// see if any rows were returned
if (mysql_num_rows($result) > 0) {
// yes
// print them one after another
echo "<table cellpadding=10 border=1>";
echo "<tr>";
echo "<td><strong>ID</strong></td>";
echo "<td><strong>Name</strong></td>";
echo "<td><strong>Date</strong></td>";
echo "<td><strong>Location</strong></td>";
echo "<td><strong>Purse</strong></td>";
echo "<td><strong>Entry Fee</strong></td>";
echo "</tr>";
while($row = mysql_fetch_row($result)) {
echo "<tr>";
echo "<td>".$row[0]."</td>";
echo "<td>" . $row[1]."</td>";
echo "<td>".$row[2]."</td>";
echo "<td>".$row[3]."</td>";
echo "<td>".$row[4]."</td>";
echo "<td>".$row[5]."</td>";
echo "</tr>";
}
echo "</table>";
}
else {
// no
// print status message
echo "No rows found!";
}
// free result set memory
mysql_free_result($result);
// close connection
mysql_close($connection);
?>
<br />
<a href="formExample.php">Form Example</a>
</body>
</html>