In this assignment, we provide an HTML interface to the administrator of the baseball_stats database. This is stage 1 of acomprehensive project to manage the baseball stats database view web form....

1 answer below »
In this assignment, we provide an HTML interface to the administrator of the baseball_stats database. This is stage 1 of a comprehensive project to manage the baseball stats database view web form. Originally the baseball stats database was created by someone who knew MySQL, but he left the company 4 years ago and his replacement does not know MySQL, so he needs an easy way to administer the baseball_stats database. At this stage, we will give the adminstrator the right to view the champs table within the baseball_stats database via a file called a9view.php. In addition, we will give the adminstrator the right to update the champs table within the baseball_stats database via a file called a9update.php. It is assumed that later we will also provide an interface to view and update the teamstats table. In order to perform these tasks, you also need to connect from the PHP script to the MySQL database which is accomplished by the a9mysqli_connect.php file. The administrator will use the home page a9index.php file to navigate between the View Champs and Update Champs Table pages. Link to the same css files used in the Ch 09 assignments covered in the textbook. You get 2 weeks to complete this assignment. It is expected that you start during Week 15 and finish during Week 16. This assignment counts for 100 points. The a9index.php, a9mysqli_connect.php, a9view.php, and a9update.php files must be free of errors that are throwing error messages with line numbers when viewed in the web server. If you submit a PHP file that has errors within it causing error messages and line numbers to appear and no output to be displayed, you will lose 3 points off of this assignment for each file. I will debug and correct the first 5 errors for you when giving feedback, but I will not debug beyond your first 5 errors. In summary, you will lose 3 points off of the final grade for each php file that is not debugged. (12 Points) To review, after Week 14, the baseball_stats database has the following records in the teamstats table In addition, the baseball_stats database has the following records in the champs table. 1. Create a HTML header named a9header.html based on the header.html file used in Ch 09 meeting the following requirements (8 points). a. Your a9header.html file should link to (3) different PHP files: a9index.php, a9view.php, and a9update.php and the 4th link goes to the official MLB website at http://mlb.mlb.com/home. (1 point) b. The h1 tag contents should be BaseBall Stats Site. (1 point) c. The h2 contents should be Ball don’t lie and numbers don’t either. (1 point) d. The first hyperlink links to the a9index.php file with contents reading Home Page. (1 point) e. The second hyperlink links to the a9view.php file with contents reading View Champs. (1 point) f. The third hyperlink links to the a9update.php file with the contents reading Update Champs Table. (1 point) g. The fourth hyperlink links to the official MLB site at http://mlb.mlb.com/home with the contents reading The Official MLB site. (1 point) h. Save the file as a9header.html in the following path on your webserver: htdocs/Ch09/includes/ If you preview the a9header.html file at this point, it will show the following output. (1 point) 2. Create the a9index.php file based on the index.php file used in Ch 09 according to the following requirements. (14 points): a. Your a9index.php file should have a page title that reads Welcome to the Baseball Stats Site! (2 points) b. The include should point to the a9header.html file stored in the includes subdirectory created in Step 1 c. The h1 content should read About the Baseball Stats Site. (2 points) d. The first paragraph reads The Baseball Stats website keeps track of Games, Wins, Losses, AtBats, HomeRuns, BatAvg, Pennants, and World Series for the Major League Baseball Teams. The h2 content should read How to use the Baseball Stats Site. (2 points) e. The 2nd paragraph should read By clicking on the View Champs link above, you can view how many Pennants and World Series games each team has won. (2 points) f. The 3rd paragraph should read By clicking on the Update Champs link above, you can update the number of Pennants or World Series won by teams after the boys of summer have gone. (2 points) g. Save the a9index.php file in the following path on your webserver: htdocs/Ch09/. If you preview the a9index.php file at this point, it will show the following output: (2 points) 3. Create the a9mysqli_connect.php file based on the mysqli_connect.php file used in Ch09. Requirements are as follows: (12 Points) a. Supply a username that you use to maintain the baseball_stats database for the DB_USER constant perhaps root if you have not set up any other usernames. (2 points) b. Supply the password for the DB_PASSWORD constant that you use for the username. (2 points) c. Supply the hostname of the server that you use for the DB_HOST constant. If it is your personal webserver, use localhost. (2 points) d. Supply baseball_stats as the DB_NAME given that you created the baseball_stats database in Weeks 13 and 14. (2 points) e. Save the a9mysqli_connect.php file in the following path on your webserver: htdocs/Ch09/. (2 points) f. You can test it and if all goes well you will get a blank page. If you made an error supplying one of the values above, supply an error message to help you to debug accordingly. (2 points) 4. Create the a9view.php file based on the view_users.php file used in Ch 09. . Save the a9view.php file in the following path on your webserver: htdocs/Ch09/. Requirements are as follows: (24 Points) a. Your a9view.php file should have a page title that reads View the Champs. (2 points) b. The include should point to the a9header.html file. (2 points) c. The Page Header h1 should read MLB Champs. (2 points) d. The require should require the a9mysqli_connect.php. Be careful about the path. If your a9mysqli_connect.php file is in the same directory as the a9view.php file, remove the ../ in the require statement from the view_users.php file or you will get a fatal error. (2 points) e. Revise the query to pick up the team, teamid, pennants, and worldseries columns from the champs table. Remember that each of these must be saved AS something as exemplified in the $q= statement used in the view_users.php file. Later whatever you save them AS will be referred to when printing the resulting table. (2 points) f. Instead of printing the number of users, print the number of baseball teams in the champs table. (2 points) g. Edit the table header to include 4 columns: Team, Team ID, Pennants, World Series. Left Align the team and right align theTeam ID, Pennants, and World Series columns. (2 points) h. Fetch and print all the records for the Team, Team Id, Pennants, and WorldSeries as the table rows. Please recall whatever you save these pieces of data AS in Step e. will need to be referred to here. (2 points) i. Close the table, free up the resources. (2 points) j. Edit the error message used if no records are returned to read There are currently no baseball teams in the database. (2 points) k. Close the database connection. (2 points) l. Include the footer.html file. (2 points) When viewed in your personal web server the result should appear as follows: (The heading and footer should appear also but are not shown in the screenshot.) 5. Create the a9update.php file based on the password.php file used in Ch09. . Save the a9update.php file in the following path on your webserver: htdocs/Ch09/. Requirements are as follows: (30 Points) a. Your a9update.php file should have a page title that reads Update thePennants and World Series. (2 points) b. Include the a9header.html file. (2 points) c. Check for for submission. (2 points) d. Require the a9mysqli_connect.php file. (2 points) e. If the Team Id is not entered on the HTML form, ensure that a message You forgot to enter the Team ID. Is displayed to the user. (2 points) f. If the Team is not entered on the HTML form, ensure that a message You forgot to enter the Team is displayed to the user. (2 points) g. If the number of Pennants Won is not entered on the HTML form, ensure that a message You forgot to enter the Pennants to be updated is displayed to the user. (2 points) h. If the number of World Series Won is not entered on the HTML form, ensure that a message You forgot to enter the World Series to be updated is updated to the user. (2 points) i. Check to see if the errors array is empty. (2 points) j. If so, check to see if a valid Team Id and Team has been entered and proceed with the necessary code to update the champs table with the Pennants and World Series. Display a message to the user that The Pennants and World Series have been updated!. (2 points) k. If the query did not run OK, display a message to the user that says System Error The Pennants and World Series could not be changed due to a system error. We apologize for any inconvenience. Provide a debugging message to the programmer displaying the query that went wrong. (2 points) l. If the valid Team ID and Team combination was not entered correctly, be sure to display a message: The team id and team name combination does not match any on file. Please view the teams again to see the correct team id and team names to use. (2 points) m. Close the database connection. (2 points) n. Include the footer.html file. (2 points) o. Test the operation of the a9update.php file by updating the following records: (2 points) New York Yankees who have won 40 Pennants and 27 World Series. San Francisco Giants who have won 22 Pennants and 7 World Series. St. Louis Cardinals who have won 22 Pennants and 11 World Series. Then click on View Champs to run the a9view.php file to view the newly updated Champs table. The results appear as follows: Submit the a9header.html, footer.html, a9index.php, a9mysqli_connect.php, a9view.php, and a9update.php files and any supporting .css files to Blackboard in the Week 16 Baseball Stats Version 3 link. Helpful Hints: 1. The most helpful resources to review for completing this assignment (besides baseball_stats database from Week 14) are the header.html, footer.html, index.php, mysqli_connect.php, view.php, and password.php files from Ch 09. 2. Remember that parse errors are usually the result of mismatched (), [], {}, “”, or ‘’. They should normally be paired up. I use the Find feature in my text editor to count all of the ( entered and then count all the ) entered. Unless you had need for an escape sequence, the counts should be the same. I repeat for the other brackets and double and single quotation marks. 3. Don’t try to code the whole program at once. Break it into smaller programs in a logical manner.
Answered Same DayJul 31, 2022

Answer To: In this assignment, we provide an HTML interface to the administrator of the baseball_stats...

Aditi answered on Aug 01 2022
35 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here