Question:
(a) What will be the output of the following extract codes? Describe fully how the program operates.
< ?php
$states_of_the_USA = array (1 => "Alabama", "Alaska", "Arizona");
$x = array_count_values($states_of_the_USA);
for ($counter=1; $counter<$x; $counter++) {
echo"
$states_of_the_USA[$counter]";
}
?>
(b) From a Web Browser and a Web Server viewpoint, explain the main processes that occur when a user request a page using PHP script to retrieve MySQL database data for inclusion in a Web Page?
(c) Consider a server with the following settings:
hostname: myserver.com
database name: monthsDB
username: root
password: my$ql
Create a connection string to connect to this database and explain each line of code.
(d) Referring to Question (c), list the PHP statements necessary to:
(i) insert a record into a database table called monthsTable having attributes month_name and number_of_days
(ii) update the existing number of days for the month of February from 28 to 29.