User's Manual

Extending the Basic Employee Form
5-4 Oracle Database Express Edition 2 Day Plus PHP Developer Guide Beta Draft
FROM employees
WHERE employee_id = :empid";
$conn = db_connect();
$bindargs = array();
array_push($bindargs, array('EMPID', $empid, -1));
$emp = db_do_query($conn, $query, OCI_FETCHSTATEMENT_BY_ROW,
$bindargs);
ui_print_header('Modify Employee ');
ui_print_modify_employee($emp[0], $_SERVER['SCRIPT_NAME']);
ui_print_footer(date('Y-m-d H:i:s'));
}
7. Edit anyco.php. Add modify_emp() to update the employee row in the
EMPLOYEES table, using the update form field values:
function modify_emp()
{
$newemp = $_POST;
$statement =
"UPDATE employees
SET first_name = :fnm, last_name = :lnm, email = :eml,
salary = :sal, commission_pct = :cpt
WHERE employee_id = :eid";
$conn = db_connect();
$bindargs = array();
array_push($bindargs, array('EID', $newemp['empid'], -1));
array_push($bindargs, array('FNM', $newemp['firstname'], -1));
array_push($bindargs, array('LNM', $newemp['lastname'], -1));
array_push($bindargs, array('EML', $newemp['email'], -1));
array_push($bindargs, array('SAL', $newemp['salary'], -1));
array_push($bindargs, array('CPT', $newemp['commpct'], -1));
$r = db_execute_statement($conn, $statement, $bindargs);
construct_employees();
}
8. Edit anyco.php. Add delete_emp() to delete an employee row from the
EMPLOYEES table:
function delete_emp()
{
$empid = $_POST['emprec'];
$statement = "DELETE FROM employees
WHERE employee_id = :empid";
$conn = db_connect();
$bindargs = array();
array_push($bindargs, array('EMPID', $empid, 10));
$r = db_execute_statement($conn, $statement, $bindargs);
construct_employees();
}
9. Edit anyco_db.inc. Add $resulttype as a third parameter to
db_do_query(). Replace the last parameter value,