Bloom Source Code

Course List

Course List

Email Name  Role  School <?php

/**
 * Title: Sahana Membership List
 * @Author: Stephen Bloom
 * @Version 1.0

/**
 * Function showerror, displays a sql error.
 * This function simply takes any sql error that may have occured
 * and displayes an error on the php page calling the query.
 * @access public
 * @return void	*/
 * @access public
 * @return void	*/

function showerror {     die("Error " . mysql_errno . " : " . mysql_error); } //Connect to localhost database if(!($connection = mysql_connect("localhost","root",""))) die("Could not connect");

//Select the cpsc225 database if(!(@ mysql_select_db("cpsc225", $connection))) showerror;

//Select the members database if(!($members = @ mysql_query("SELECT * FROM members", $connection))) showerror;

//for each row print the data into the table while($row = mysql_fetch_array($members, MYSQL_NUM)) {   $email = $row[0]; $name = $row[1]; $role = $row[2]; $school = $row[3]; $teamid = $row[4];

if(!($team= @ mysql_query("SELECT teamName FROM teams WHERE id = $teamid", $connection))) showerror; } $team_row = @ mysql_fetch_array($teams, MYSQL_NUM); $team = $team_row[0]; // Query Get the school's state if (!($state_result = @ mysql_query ("SELECT state FROM schools WHERE name='{$school}'", $connection))) showerror; $state_row = @ mysql_fetch_array($state, MYSQL_NUM); $state = $state_row[0]; print " {$name}  {$email}  {$school}  {$state}  {$role}  {$team}  ";

?>