Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve Q2) Solve Q2) Solve Q2) Solve Q2) Solve Q2) Solve Q2) Solve Q2) Test Content Question 1 22 Points Assume you have football TeamsDB

image text in transcribed

image text in transcribed

image text in transcribed

Solve Q2)

Solve Q2)

Solve Q2)

Solve Q2)

Solve Q2)

Solve Q2)

Solve Q2)

Test Content Question 1 22 Points Assume you have football TeamsDB database stored in MySQL server that contains the following 2 tables as follows: Table 1: teams Table 2: matches id id int, Primary Key, Auto Increment int, Primary Key, Auto Increment logo int name int homeTeamID int. Foreign Key to id in teams table away Team ID int, Foreign Key to id in teams table country varchar(50) matchScore varchar(50) matchScore 2-1 Sample Data teams table matches table id logo name country id home TeamID away TeamID 1 Spain 1 barcelona.png Barcelona 1 2 2 1 2 bayern.png Bayern Munchen Germany 3 3 2 4 3 liverpool.png Liverpool England 4 2 5 4 manutd.jpeg Manchester United England 5 3 4 5 realmad.png Real Madrid Spain 6 3 5 3-3 0-1 2-3 4-2 2-2 The matches tables contains the match scores between the teams defined in teams table. Use the following Connection.php by including it in your scripts which connect you to MySQL server and the database. setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 2x to MySQL server and the database. setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); . Q1: Implement viewTable.php: write PHP script to process the data stored in the database tables and generate the following output as shown in the screenshot.. Note the following: Played (P): count the number of matches played as home or away. Wins (W), draws (D) and losses (L): count the number of wins/draws/losses respectively in matches played as home or away Points (Pts): shows the total points each team have. Note that 3 points is given for each win, 1 point for each draw and 0 points for each losses. . Team PW D L Pts .. 3 1 1 1 4 Barcelona 4 1 10 33 Bayern Munchen 3 1 2 lo 5 Liverpool 3 3 1 1 1 114 Manchester United 2 1 1 O 4 Real Madrid 1 1 1 14 Manchester City Question 2 20 Points Q2: Implement addNewTeam.php: Use the same database tables given in Part 1 to.. solve this part. Examine the following code that contains new team details (name, logo and country) with unknown number of matches. The matches data consider the new team as HOME and the other teams as AWAY. $newTeam['newTeamDetails']=array("Manchester City", "mancity.png","England"); $newTeam['matches Against'][ ]=array( "Barcelona", "3-1"); $newTeam['matchesAgainst'][ ]=array( "Manchester United", "2-2"); $newTeam['matches Against'][ ]=array( "Bayern Munchen", "O-1"); Write PHP script that insert the new team details and all the matches in the corresponding database table. Your script should count and display the number of matches inserted. Your script should make sure All details are inserted successfully or none of them. In addition, you should insert all matches details into the matches table using PDO PREPARED STATEMENTS. Use the editor to format your

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago