$username="user";
$password="password";
$database="company";
$pnum=$_GET['pnum'];
mysql_connect("host.domain.edu",$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT pname,plocation,dnum,dname FROM project,department where pnumber=$pnum and dnum=dnumber";
$result=mysql_query($query);
$num=mysql_numrows($result);
$pname=mysql_result($result,0,"pname");
$ploc=mysql_result($result,0,"plocation");
$pdnum=mysql_result($result,0,"dnum");
$pdname=mysql_result($result,0,"dname");
echo "Project: ", $pname, "
";
echo "Project Location: ", $ploc, "
";
echo "Controlling Department: ", $pdname, "";
echo "Employees working in project:
";
$query="SELECT ssn,lname,fname,hours FROM employee,works_on where pno=$pnum and essn=ssn";
$result=mysql_query($query);
$num=mysql_numrows($result);
if ($num > 0) {
?>
Employee SSN |
Employee Last Name |
Employee First Name |
Hours |
$i=0;
while ($i < $num) {
$essn=mysql_result($result,$i,"ssn");
$elname=mysql_result($result,$i,"lname");
$efname=mysql_result($result,$i,"fname");
$hours=mysql_result($result,$i,"hours");
?>
echo $essn; ?> |
echo $elname; ?> |
echo $efname; ?> |
echo $hours; ?> |
$i++;
}
} else
echo "Project has no employees
";
echo "
";
mysql_close();
?>
Return to main page