Sunday, 29 May 2016

Week 13 Lab class

Today is our last class and we had a online quiz. My result is not good because not enough time to do.




Week 12 Lab class

Today our lab class replaced with the program sport day SMMTC WEEK.





9/5/2016 Lab Class

Today our lab session is using phpMyAdmin create a application. Lecturer had uploaded a zip file and we were required to connect it to the database. 


We need to create a new user account.





Tick "Grant all privileges on wildcard name"






Next step is to select the database and create the database then will go to create table by inserting the numbers of column.





This is the result of INSERT INTO data to table.




After insert the data, I tried to open the form using localhost.





































Class 2/5/2016 (Week 10)


Today class is about MySQL. We learnt about the Server Side Script which is MySQL. SQL is a standard language for accessing databases. We have learned about Database, DBMS, and also relational Databases.


What is SQL (Structured Query Language)
  • SQL stands for Structured Query Language
  • SQL allows you to access a database
  • SQL is an ANSI standard computer language
  • SQL can execute queries against a database
  • SQL can retrieve data from a database
  • SQL can insert new records in a database
  • SQL can delete records from a database
  • SQL can update records in a database
  • SQL is easy to learn

Data Manipulation Language (DML)
These query and update commands together form the Data Manipulation Language (DML), 
part of SQL:

  • SELECT - extracts data from a database
  • UPDATE - updates data in a database
  • DELETE - deletes data from a database
  • INSERT INTO - inserts new data into a database


Data Definition Language  

The most important DDL statements in SQL are:
  • CREATE TABLE - creates a new table
  • ALTER TABLE - modifies a table
  • DROP TABLE - deletes a table
  • CREATE INDEX - creates an index (search key)
  • DROP INDEX - deletes an index 


Accessing MySQL via PHP
There are four steps process to access MySQL from a PHP script: 

Step 1: Make a connection to MySQL database server .
  • require that you specify the location of the database, plus a username and password.

Step 2: Select the database within MySQL that you want to work with .
  • Example: select "SIS" database.

Step 3: Issue an SQL statement/create the query.
  •  could be any valid SQL keyword, example: SELECT, UPDATE.

Step 4: Iterate through the SQL result set: if you are issuing a SELECT statement, iterate through the result set and extract each record.
  •  Example: extract specific fields in each record and display as HTML.



















Saturday, 23 April 2016

21/4/2016

Today lab class is to do past year Final Exam Question STIV3013 sem 1 2015-2016 ^_^


Answer of Question: -
1.   //retrieve information from the Form
$name = $_POST (“name”);
$matric = $_POST (“matric”);
$stiv1023_mark = $_POST (“stiv1023_mark”);
$stiv2023_mark = $_POST (“stiv2023_mark”)
$stiv3013_mark = $_POST (“stiv3013_mark”);
$vkhb2031_mark = $_POST (“vkhb2031_mark”);


2.  //calculate grade for each course by calling calculateGred() function
$stiv1023_grade = calculateGred($stiv1023_mark);
$stiv2023_grade = calculateGred($stiv2023_mark);
$stiv3013_grade = calculateGred($stiv3013_mark);
$vkhb2031_grade = calculateGred($vkhb2031_mark);


3.  //calculate point for each course by calling calculatePoint() function
 $stiv1023_point = calculatePoint($stiv1023_grade);
$stiv2023_point = calculatePoint($stiv2023_grade);
$stiv3013_point = calculatePoint($stiv3013_grade);
$vkhb2031_point = calculatePoint($vkhb2031_grade);


4.  //calculate TotalPoint based on point for each course and credit
      $TotalPoint=($stiv1023_point*3)+($stiv2023_point*3)+($stiv3013_point*3)+          
                            ($vkhb2031_point*1);


5.  //calculate GPA based on Total Point and total credit
  $GPA = TotalPoint/10;


6.  //calculate final result by calling calculateResult() function
    $Final_Result = calculateResult($GPA);


7.  //function to calculate the grade based on mark
 calculateGred($mark)
 {
if ($mark >= 90)
$grade = ‘A’;
else if ($mark>=80)
$grade = ‘B’;
else if ($mark>=70)
$grade = ‘C’;
else if ($mark>=60)
$grade = ‘D’;
else if ($mark>=50)
$grade = ‘E’;
else
$grade = ‘F’;
return $grade
}


8.  //function to calculate the point based on grade
calculatepoint($grade)
{
if ($grade== ‘A’)
$point= 4.0;
else if ($grade== ‘B’)
$point=3.5;
else if ($grade==’C’)
$point=3.0;
else if ($grade= ‘D’)
$point= 2.5;
else if ($grade= ‘E’)
$point= 2.0;
else
$point= 1.0;
return $point


9.  //function to calculate the result based on GPA
calculateResult($GPA)
{
If  ($GPA >= 3.00)
$GPA = “Pass with distinction”;
else if ($GPA >= 2.00)
$GPA = “Pass”
else
$result= “Fail”;
Return result;


}

4/4/2016

Today our class Lecturer ask us to mark the Lab Tutorial Exercise that has given in last week. Lecturer also teach our calculate BMI by using PHP. 

The below is the BMI formula:



31/3/2016

In the lab class 31/3/2016, a test about PHP was given by our lecturer, Dr.Syamsul. 
Here are the output for this week lab:

Question 1

Question 2
Question 2(b)
Question 3
Question 4







Server Side Script (PHP)


28/3/2016 we learned about PHP.

What is PHP?

  • PHP is one of the server-side scripting languages.
  • PHP was originally called Personal Home Page.
  • PHP is an open source and eventually the name changed to PHP Hypertext Pre-processor.
  • PHP scripts can be embedded within HTML to create dynamic and interactive web pages (e-commerce or application web-based system).

Advantage of PHP:
  • Capable
  • Secure
  •  Easy to use
  •   Free of cost
  • Large communities
  •  Faster development
  • Platform independent
  • Supports all major web servers
  • Supports all major databases
  •   Proven and trusted  
What is a PHP file??
  • PHP file can contain text, HTML, CSS, JavaScript, and PHP code
  • PHP code are executed on the server, and the result is returned to the browser as plain HTML
  • PHP file fave extension ".php"

What can PHP do??
  • Evaluate form data sent from a browser.
  • Build a custom web content to serve the browser.
  • Talk to a database.
  •  generate dynamic page content
  •  create, open, read, write, delete, and close files on the server
  • send and receive cookies
  •  add, delete, modify data in database
  •  be used to control user- access
  •  encrypt data

Operators
PHP supports several different types of operators that can be used in simple or complex expressions.

Arithmetic Operators
Comparison Operators

 Logical Operator












Friday, 25 March 2016

Thursday, 24 March 2016

Week 4 Lab Quiz



We had a lab quiz for this week lab~
Lecturer uploaded the lab test on the Online Learning UUM~
This quiz closed on Thursday, 17 March 2016, 4:20 PM,Time limit: 40 mins
Our class start on 2.30pm and we start our lab test on 2.40pm~



Week 4

14 March 2016
 The topic that we were talking about is Concept of Client Server & Internet Application.




There are 2 parts of scripting languages:
  1. Client- side scripts (css) for browser
  2. Server- side scripts (sss) for server

Client- side scripts

•Scripts are interpreted or executed by the browser/client
•Example: JavaScript, Jscript, VBScript
•Can be embedded into HTML documents or contained in separate file
•Used to validate user input, accesses the browser and enhances Web Pages with DHTML, ActiveX controls and Java applets
•Processed at the browser, not processed at the Web server– longer downloading time depending on the size
•Reduces the number of requests that need to be passed to server. Thus reduced server load
•Browser dependence
•The browser must support the scripting languages
•To see CSS, view the source

Server- side scripts

•Example: PHP, ASP, ASP.Net, JSP, CGI

•Provide interactive web sites that interface to databases or other data stores 

•Processed by the server to generate html and return as response to the browser

•Scripts are embedded in html documents

•Specialty…

–Browser/Client independence 

–Response time is small

–Data retrieved from database, not left at the client

–Powerful