User's Manual
Extending the Basic Employee Form
Beta Draft Updating Data 5-5
OCI_FETCHSTATEMENT_BY_ROW, in the oci_fetch_all() call with a variable
so callers can choose the output type.
function db_do_query($conn, $statement, $resulttype,
$bindvars = array())
{
$stid = oci_parse($conn, $statement);
...
$r = oci_fetch_all($stid, $results, null, null, $resulttype);
return($results);
}
10. Edit anyco_db.inc. Inside the db_get_page_data() function insert
OCI_FETCHSTATEMENT_BY_ROW as the third parameter value in the
db_do_query() call:
function db_get_page_data($conn, $q1, $current = 1,
$rowsperpage = 1, $bindvars = array())
{
...
$r = db_do_query($conn, $query, OCI_FETCHSTATEMENT_BY_ROW, $bindvars);
return($r);
}
11. Edit anyco_db.inc. Add a db_execute_statement() function to execute
data manipulation statements:
function db_execute_statement($conn, $statement, $bindvars = array())
{
$stid = oci_parse($conn, $statement);
if (!$stid) {
db_error($conn, __FILE__, __LINE__);
}
// Bind parameters
foreach ($bindvars as $b) {
// create local variable with caller specified bind value
$$b[0] = $b[1];
$r = oci_bind_by_name($stid, ":$b[0]", $$b[0], $b[2]);
if (!$r) {
db_error($stid, __FILE__, __LINE__);
}
}
$r = oci_execute($stid);
if (!$r) {
db_error($stid, __FILE__, __LINE__);
}
return($r);
}
12. Edit anyco_ui.inc. Change ui_print_employees() to produce a HTML
form containing the employee rows. The function becomes:
function ui_print_employees($employeerecords, $posturl)
{
if (!$employeerecords) {