Question: Figure 3 and Figure 4 are the registration forms shown in the design view and code view. The registration form allows players to sign up

 Figure 3 and Figure 4 are the registration forms shown in

the design view and code view. The registration form allows players to

sign up for the online game competition - King's Glory. A database

table named Players has been created in the MYSQL database with all

Figure 3 and Figure 4 are the registration forms shown in the design view and code view. The registration form allows players to sign up for the online game competition - King's Glory. A database table named Players has been created in the MYSQL database with all the necessary fields, as shown in Table 2. Based on the information given in Figure 3, Figure 4 and Table 2, answer the following questions to complete the registration function. King's Glory Battle Arena - Player Registration Player ID: Player Name : Game Score : Hero Used: Tanker Submit Cancel Figure 3: Player Registration Form - Design View

King's Glory Battle Arena - Player Registration

Player ID :
Player Name :
Game Score :
Hero Used :

Figure 4: Player Registration Form - Code View Data Type Size Primary Key Null Auto Column Name Increment player_id player_name game_score hero_used Table 2: Players Table Structure 100 INTEGER VARCHAR DOUBLE VARCHAR 100 a) Create constants to hold the following database server information. username password hostname database_name root pass localhost gloryking (4 marks) b) Based on the constants created in Q3 a), write code to establish connection to MYSQL. (4 marks) c) Create variables to retrieve user input when the form is submitted. Exclude unnecessary white space when retrieving the inputs. (4 marks) d) Examine the following validation requirements and use the preg_match function to validate the submitted user input: Field pName Validation Requirements Contains only uppercase and lowercase alphabet and space. The first three characters must be an alphabet. NOTE: You should achieve the validation rules using ONE (1) preg_match function and return true if the input fulfilled the validation rules. Else, return false. Only two decimal places allowed. Values before the decimal point must be at least 1 number. Example: 5.09 score NOTE: You should achieve the validation rules using ONE (1) preg_match function and return true if the input fulfilled the validation rules. Else, return false. (10 marks) e) Write code to insert the registration data into the Players table

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!