Team Awesome Source Code

[article] [edit page] [discussion] [history]

From Humanitarian-FOSS Project Development Site

                 "-//W3C//DTD HTML 4.01 Transitional//EN"
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <title>CPSC 225 CLASS LIST by Team Average Joe</title>
	 * Prints classmates information based on information in a MYSQL databse. 
	 * We used Joint Queries to display the data from mutliple tables.
	 * @author DeSimone, Narva
         * @version 1.0
	 * ShowError is a default error function written in case errors occur
	 * while connecting to the databse.
         * @access public
         * @return void
	   function showerror()
	      die("Error " . mysql_errno() . " : " . mysql_error());

    * Open the databse connection. If there is an error instead of printing out possible information
    * that could expose your username and password, the default error is overwritten, instead dying
    * saying only "could not connect"
   if (!($connection = @ mysql_connect("localhost","root","")))//Open the database connection
      die("Could not connect");

   if (!(@ mysql_select_db("cpsc225", $connection)))// (Selects the cpsc225 databse

	 * Join queries are used match information from the three tables, members, schools, and teams.
	 * The information is then tied together using "WHERE" statements. Finally the data is organized b
	 * team for easier viewing. If mysql query fails showerror msg is shown.
   if (!($result = @ mysql_query (
	       FROM members,teams,schools
	       WHERE AND
	       ORDER BY teams.team_key", //order by team name
		 * HTML to create, and label the table.
   		echo "<center>";
		echo "<table border='1'>";		
		echo "<tr>";	
		echo "<thead>";
	        echo "<TD>
	    	 <TD><CENTER><B>Team Name</CENTER>
   while ($row = @ mysql_fetch_array($result, MYSQL_NUM))
      foreach ($row as $attribute) //each sql value is put into an HTML table. 
      	echo "<td>";
        print "{$attribute} ";
        echo "</td>";
	  echo "<tr>";
      print "\n";

Personal tools