Enter the employee last name:
_HTML_;
}
function printtable($lname) {
$user='pld';
$password='blue';
$database="office";
$added=0;
$fail=0;
$db=MDB2::connect("mysqli://$user:$password@localhost/$database");
if (MDB2::isError($db)) {
die("cannot connect: " . $db->getMessage());
}
$query = "select e.fname, e.lname, e.ssn, e.bdate, e.salary, d.dname from employee e,department d where e.dno=d.dnumber and e.dno=? and e.lname=?";
$types = array('integer', 'text');
$qstmt = $db->prepare($query, $types, MDB2_PREPARE_RESULT);
$queryargs = array(5, $lname);
$qres = $qstmt->execute($queryargs);
if (MDB2::isError($qres)) {
print("query not successful: " . $qres->getMessage());
$fail=1;
}
print "data table:
"; table_format($qres); } function table_format($queryres) { $nullval="null"; // can use "" as desired print "
"; print $colname; print " | "; } print "
---|
"; if ($row[$j] == NULL) print $nullval; else print $row[$j]; $j++; print " | "; } print "