Web Programming 2 Sesiii20082009

  • Uploaded by: Khirulnizam Abd Rahman
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Web Programming 2 Sesiii20082009 as PDF for free.

More details

  • Words: 558
  • Pages: 4
TRP 4013

FEBRUARY 2009 SECTION A Marks: 40

Answer ALL questions in the answer sheet provided.

1.

Explain two advantages of server-side scripting. (4 marks)

2.

List four different languages for server-side scripting. (4 marks)

3.

Explain two differences of client-side and server-side scripting. (4 marks)

4.

Write four different statements to display the value inside a variable named $studentsMatrixNo. (4 marks)

5.

Let say you have this array in your program; $fruits= array (“Banana”, “Apple”, “Rambutan”); Create the program in PHP to print all the values in the array by using loop. (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 8.

FEBRUARY 2009

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)

10.

Explain the term session in server side programming approach. What is the main benefit from implementing the session? (4 marks)

CONFIDENTIAL 3

TRP 4013

FEBRUARY 2009

SECTION B Marks: 20 Answer only ONE question in the answer sheet provided. 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 This question is based on Figure 2.

Figure 2: The database is named dbInfo and the table name is tableInfo. a.

Write the PHP statements to connect to the database in Figure 2. Use localhost as the server address, the user name is A and the password is B. (2 marks)

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

Related Documents


More Documents from "Syahidatul Khasanah"