User's Manual

Using PL/SQL to Capture Business Logic
6-4 Oracle Database Express Edition 2 Day Plus PHP Developer Guide Beta Draft
In the results window, confirm that the function is created:
10. Create the chap6 directory and copy the application files from chap5:
mkdir $HOME/public_html/chap6
cp $HOME/public_html/chap5/* $HOME/public_html/chap6
cd $HOME/public_html/chap6
11. Edit anyco.php. Modify the query in construct_employees() to call the
PL/SQL function for each row returned:
$query =
"SELECT employee_id,
substr(first_name,1,1) || '. '|| last_name as employee_name,
hire_date,
to_char(salary, '9999G999D99') as salary,
nvl(commission_pct,0) as commission_pct,
to_char(calc_remuneration(salary, commission_pct),'9999G999D99')
as remuneration
FROM employees
WHERE department_id = :did
ORDER BY employee_id ASC";
12. Edit anyco_ui.inc. In ui_print_employees() add a Remuneration
column to the table, and modify the foreach loop to display the remuneration
field for each employee:
echo <<<END
<form method="post" action="$posturl">
<table>
<tr>
<th>&nbsp;</th>
<th>Employee<br>ID</th>
<th>Employee<br>Name</th>
<th>Hiredate</th>
<th>Salary</th>
<th>Commission<br>(%)</th>
<th>Remuneration</th>