<?php
  include("config.php");
  require_once("rating/classes/include.all.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>CSS Star Rating System fully functional using AJAX</title>
    <link type="text/css" href="rating/styles/rating.css" rel="stylesheet" media="all" />
    <script type="text/javascript" src="rating/scripts/prototype.js"></script>
    <script type="text/javascript" src="rating/scripts/rating.js"></script>
  </head>
  <body>
    <h4>Race Rating System:</h4> 
    <?php
      
      $row = mysql_fetch_array(mysql_query("SELECT uid FROM gforum_Triathlons WHERE uid = 100"));
    
  	  $foo = $row[uid];
      
      $ratingData = Rating::OutputParentRating("$foo");
      
      if (Error::HasErrors())
      {
        echo Error::ShowErrorMessages();
        Error::ClearErrors();
      }
      else
      {
        echo $ratingData;
      }
    ?>
    <?php
      
      $catResults = mysql_query("SELECT * FROM gforum_TriathlonsRatingCategory");
      
      while ($catRow = mysql_fetch_array($catResults)) {
      
      	  $bar = $catRow[rating_cat_id];
      
		  $ratingData = Rating::OutputRating("$foo","$bar");
		  
		  if (Error::HasErrors())
		  {
			echo Error::ShowErrorMessages();
			Error::ClearErrors();
		  }
		  else
		  {
			echo $ratingData;
		  }
		  
	  }
	?>
  </body>
</html>
<?php
  Database::DeInitialize();
?>