Professional Documents
Culture Documents
SECTION A
Marks: 40
4. Write four different statements to display the value inside a variable named
$studentsMatrixNo.
(4 marks)
6. Write the command (in PHP) to connect to a database named myDB that
resides in 172.16.12.3, using the username root and the password dbserv.
(4 marks)
7. Create the SQL command to display all the fields from table Contact where
the field Name starts from the letter ‘S’ and the field State is equals to ‘Johor’ .
(4 marks)
CONFIDENTIAL
2
TRP 4013 FEBRUARY 2009
8. Write the SQL command to delete all the records from a table named
computers, with the year from the field dateOfPurchase is after 2005 and the
memory capacity is more than 1GB (from the memory field).
(4 marks)
9. You need to create an option list (combo box) using one of the HTML input
element, select. The option list must contain the list of years from 1960 till the
current year (2009). Write the combination of HTML codes and the PHP script
to create the option list, using one of the repetition statements.
(4 marks)
CONFIDENTIAL
3
TRP 4013 FEBRUARY 2009
SECTION B
Marks: 20
Question 1
Figure 1
a. You are required to write the HTML code for the HTML document shown in
Figure 1 above. Create a form named formInfo and send the data to a file
named saveRecord.php and the method is GET. Give a name to each of the
input component. “REGISTER NOW!” is the submit button and “CLEAR the
form!” is the reset button.
(10 marks)
b. Develop a page with PHP script to save the record entered by the user using
the form in question 1 (a). The MySQL server location is 172.16.12.145, with
the username root and the password abc123. There is a table named contact
with the fields firstname, lastname, gender and email.
(10 marks)
CONFIDENTIAL
4
TRP 4013 FEBRUARY 2009
Question 2
Figure 2: The database is named dbInfo and the table name is tableInfo.
b. Write the PHP statements that contain the SQL query to insert a complete
record into the table, in Figure 2.
(6 marks)
c. Write the PHP statements that contain the SQL query to select all the records
from the table.
(4 marks)
d. Write the PHP statements that contain the SQL query to delete all the records
from the table.
(4 marks)
e. Write the PHP statements that contain the SQL query to update one record
from the table.
(4 marks)
CONFIDENTIAL
5