Assignment No. 02
CS406 – Web Based Database Applications Total Marks: 20
Due Date: 05-Dec-2019
Assignment Submission Instructions:
Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:
o Assignment is submitted after due date.
o Submitted assignment does not open or file is corrupt.
o Assignment is copied (From internet/ to from students).
o You must submit assignment only in .php format, and you must keep all your files in a single folder and zip the folder to upload .zip or .rar file on LMS.
Week 4, Week 5 and Week 6 Lectures have been covered.
The purpose of this assignment is to make you familiar with following topics:
• PHP Syntax, Data Types, Variables and Variables scope
• PHP Functions and Controls, Functions, Control Structures, Loops, Arrays
• Embedded PHP, Embedded PHP in HTML 5, Strings in PHP
Assignment Marks: 12+8
Write a program in PHP using for loop and embed it in HTML.
- The title “Assignment No 2” should be on the top of the page.
- The border size of the table should be 1.
- There should be 3 Columns and 10 Rows.
- Create 2 arrays, one for Order Quantity and One for Unit price and then multiply Order quantity with Unit price and show it result in 3rd column.
- You will use a single loop to print the values of arrays and the result.
Hint: You can also embed html tags in PHP code.
Sample Out Put:
Write a function (totalWords) in PHP which will receive two strings. After receiving the strings it will find total words in each string individually using built-in function str_word_count() and then it will return the total words of both the strings and then print the total words on the screen.
For example :
String 1= “Virtual University of Pakistan”
String 2= “Federal Government University”
Total Words = 7
Deadline: Your assignment must be uploaded on or before the given due date. We shall not accept your solution through email after the due date.