[ad_1]
Lesson 13
Lab 13 – Answering questions using JOINS and AGGREGATE FUNCTIONS
1 Objectives:
- Develop two mysql queries than can be used to answer questions for users
- Create a PHP empowered webpage that displays the results of your mysql queries
2 Lab overview
- What we have done so far:
- Installed XAMPP and set up the local web application development environment.
- Created a personnel database in Lesson 10
- Reviewed connecting to a database in PHP
- In this lab, we will only develop a backend program to display results from the database. It will be a “dumb” program, and hard coded to answer specific questions
- You will submit 2 files for this lab. NAMING CONVENTION:
- PHP Back-end Program:lastname-timesheets.php
- SCREENSHOT PHP RESULTS:png
3 Lab Task Checklist
- It is expected you have read the required reading in this Lesson before starting the lab.
- Review the customer requirements:
Customer Requirements:The accounting team needs personnel records displayed in an easy to understand way. The customer has provided an existing report for you to model your code on.
As part of an iterative development effort, this lab will display a report that is hard coded to return all employee work hours, listed by employee name. Future requirements will expand this report.
|
- Review the attached Wage Report.pdf. You will use thisto create your backend program (php) within your text editor.
- Create a new php file using naming conventions. Make sure you save in the correct xampp location (/htdocs) so you can run and test the code. See Lab Instructions.
- Create a new css file using naming conventions
- Copy the contents of Wage Report.pdf into your new PHP file
- Follow lab instructions to alter PHP file
- Use XAMPP and the URL address to test your web application
- Validate all .html and .css files. .php does not require validation.
- Zip all the files to be uploaded in one package. Make sure you have included images if needed.
- Submit all files/s (zip) to Blackboard
4 Lab instructions – creating a backend report
- Open your text editor/Notepad++ and create a new file for HTML and PHP, and a separate new file for CSS.
- Save the renamed files to x:xampp\htdocs\cti110\coursework folder. Your path may differ BUT in needs to be in your \xampp\htdocs folder for localhost to work and to test with the backend program.
- You will need to modify the files to ensure correct linkage (Relative Addressing should be used…assumption all files in same location/folder)
- Link the css file to the .php file
- Link from form to php code program
- Link back to form once transaction complete
- Translate the Wage Report.pdf to actual php code using your text editor.
- What the attached pdf structure does:
- Creates a PHP Program to process the information from the form web page to retrieve user requirements. Retrieves all input data from the web form file using $_POST
- Queries database for all the employee IDs that match a job title and make more than a certain amount.
- Outputs the ID in an HTML format
- Alter given PHP code in the following four ways:
- Find where $hourlyWage and $jobTitle are being set using $_POST and remove these lines
- Find the $userQuery and write an SQL line that uses the follow information:
- Results to select: lastName, personnel.empID as ID, sum(timesheet.hourworked) as total
- Tables to search: personnel, timesheet
- Ensure ID’s are the same using the where clause
- Use “Group by” to group employees for the SUM
- Alter the heading of the results table to be appropriate for new results
- Alter the printing of each table row to print the correct result in each column (lastName, ID, total)
- Test PHP code using XAMPP and Browser
- Ensure Apache and MYSQL are running
- Load PHP file in browser
- Screenshot results and save as an image file.
- Zip PHP code and image and submit via Blackboard
5 additional Lab instructions
5.1 Example Renders of completed lab:
Render: lastname-input.php
[ad_2]
Computer Science