The interactions in this eCourse require Javascript to be enabled.
Getting Employee Information
previous|next
The construct_employees() function:
Builds and executes the query to obtain the employee records for a specific department
Obtains the department ID from the deptid HTTP request parameter. If this parameter is not set, then one of the conditions in the query WHERE clause is structured to return all employee rows.
Calls ui_print_header(), ui_print_employees(), and ui_print_footer() to generate the response page
The employee query demonstrates the use of a bind variable in the WHERE clause. A bind variable is a named string prefixed with a colon (:), as in the following example: ... WHERE department_id = :did ... A bind variable is a placeholder for an actual value that is supplied when the query is executed. The $bindargs PHP array variable is created to store the value associated with the query bind variable before it is executed. $bindargs is supplied as a parameter to the db_do_query() function. Note: The ui_print_employees() function, which generates the HTML table of employee data, detects the presence of the deptid HTTP parameter and creates a Back button to enable the user to navigate back to the page displaying the department information.