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 ""; // $rowcount=mysql_numrows($query); // $i=0; // $colnames = array_keys($queryres -> getColumnNames()); $colnames = $queryres -> getColumnNames(); print ""; foreach ($colnames as $colname => $colnum) { print ""; } print "\n"; while ($row = $queryres -> fetchRow(MDB2_FETCHMODE_ORDERED)) { print ""; $j=0; while ($j < count($row)) { print ""; } print "\n"; $i++; } print "
"; print $colname; print "
"; if ($row[$j] == NULL) print $nullval; else print $row[$j]; $j++; print "
"; } ?>