• Cyberian's Gold

    Assignment No. 02
    Fall 2019
    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.

    Lectures Covered:

    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
    Question 1:

    Write a program in PHP using for loop and embed it in HTML.

    1. The title “Assignment No 2” should be on the top of the page.
    2. The border size of the table should be 1.
    3. There should be 3 Columns and 10 Rows.
    4. 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.
    5. 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:

    Question 2:

    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.

  • Cyberian's Gold

    @zareen said in CS406 Assignment 2 Solution and Discussion:

    Write a program in PHP using for loop and embed it in HTML.

50% Off on Your FEE Join US!

Quiz 100% Result If you want to know how you can join us and get 50% Discout on your FEE ask Cyberian in Chat Room! Quiz 100% Result Quiz 100% Result
| |