<?php
// input is $name - the person to highlight in the hierarchy
// connect to the database
   
if(!($dblink=mysql_connect("shares.cems.uwe.ac.uk","cwstudent","cwstudent"))) {
     print(
"mysql_connect failed<br>\n");
     exit;
   }

   if(!(
mysql_select_db("Emp",$dblink))) {
     print(
"cannot connect to database $db");
     exit;
   }
// get the employee data
   
$query "select * from emp where ename = '$name';";
   if(!(
$dbresult mysql_query($query,$dblink))) {
        print(
"<b>query failed</h4><br>\n");
        print(
mysql_error() . "<br>\n");
   }

   
$emp=mysql_fetch_object($dbresult) ; 
   
print <<< END
<table border=1>
<tr><th>EmpNo</th><td>$emp
->empno</td></tr>
<tr><th>Ename</th><td>$emp
->ename</td></tr>
<tr><th>Job</th><td>$emp
->job</td></tr>
<tr><th>Mgr</th><td>$emp
->mgr</td></tr>
<tr><th>Hiredate</th><td>$emp
->hiredate</td></tr>
<tr><th>Sal</th><td>$emp
->sal</td></tr>
<tr><th>Comm</th><td>$emp
->comm</td></tr>
<tr><th>Deptno</th><td>$emp
->deptno</td></tr>
</table>
END;


?>