User's Manual
Building the Basic Employee Form
4-12 Oracle Database Express Edition 2 Day Plus PHP Developer Guide Beta Draft
AND l.country_id = c.country_id
GROUP BY d.department_id, d.department_name,
substr(e.first_name,1,1)||'. '||e.last_name,
c.country_name
ORDER BY d.department_id ASC";
The query string is enclosed in double quotes to simplify writing the statement
which contains SQL literal strings in single quotes.
3. Save the changes to your files, and test the changes by entering the following URL
in a Web browser:
http://localhost/~<username>/chap4/anyco.php
The Web page result should resemble the following output:
Building the Basic Employee Form
To display employees, perform the following tasks:
1. Edit anyco.php. Add a function construct_employees() which constructs
the employee query, calls db_do_query() to execute the query, and prints the
results using ui_print_employees():
function construct_employees()
{
$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
FROM employees
ORDER BY employee_id asc";
$conn = db_connect();
$emp = db_do_query($conn, $query);
ui_print_header('Employees');
ui_print_employees($emp);
ui_print_footer(date('Y-m-d H:i:s'));
}
2. Edit anyco.php. Replace the call to construct_departments() with a call to
construct_employees():
<?php // File: anyco.php
require('anyco_cn.inc');
require('anyco_db.inc');