You are on page 1of 42

Dynamic Web

Page Creation
PHP and MySQL

Percival
Percival A.
A. Fernandez
Fernandez
Dynamic Web Page Creation
PHP and MySQL

 What is a Webpage? Website?


 What is the difference between Static
Webpage and Dynamic Webpage?

 Difference between a script and a


program?

 What is a Database? SQL Commands?


Dynamic Web Page Creation
PHP and MySQL

Webpage
 A document which can be displayed in a web
browser such as Firefox, Google Chrome,
Opera, Microsoft Internet Explorer or Edge, or
Apple's Safari. These are also often called just
"pages.“
Website
 A collection of web pages which are grouped
together and usually connected together in
various ways. Often called a "web site" or
simply a "site."
Dynamic Web Page Creation
PHP and MySQL

Web server
 A computer that hosts a website on the
Internet.
Dynamic Web Page Creation
PHP and MySQL

Static Webpage
 Static by definition means something that does
not change. The first pages on the World Wide
Web were largely static and unchanged,
delivering the same information about a
particular topic to anyone who visited.
Dynamic Webpage
 Dynamic web pages contents displayed on the
website may change from user to user and/or
from time to time. Examples of the dynamic web
pages are Amazon, Yahoo, Gmail, CNN and iTunes
websites.
Dynamic Web Page Creation
PHP and MySQL

Script
 "Scripts" are distinct from the core code of the
application, which is usually written in a different
language, and are often created or at least
modified by the end-user.
Program
 The program has an executable form that the
computer can use directly to execute the
instructions. The same program in its human-
readable source code form, from which executable
programs are derived (e.g., compiled)
PHP
Hypertext Preprocessor

Percival
Percival A.
A. Fernandez
Fernandez
Dynamic Web Page Creation
PHP and MySQL

 PHP stands for Hypertext Preprocessor.


 PHP is a very popular and widely-used
open source server-side scripting language
to write dynamically generated web pages.
 PHP was originally created by Rasmus
Lerdorf in 1994.
 It was initially known as Personal Home
Page.
Dynamic Web Page Creation
PHP and MySQL

 It is used to manage dynamic content,


databases, session tracking, even build
entire e-commerce sites.
 It is integrated with a number of popular
databases, including MySQL, PostgreSQL,
Oracle, Sybase, Informix, and Microsoft SQL
Server.
PHP scripts are executed on the server and
the result is sent to the web browser as
plain HTML
Dynamic Web Page Creation
PHP and MySQL

What You Can Do with PHP


 You can generate pages and files
dynamically.
 You can collect data from a web form such
as user information, email, phone no, etc.
 You can send emails to the users of your
website.
Dynamic Web Page Creation
PHP and MySQL

What You Can Do with PHP


 You can store, delete, and modify
information in your database.
 You can restrict unauthorized access to
your website.
 You can encrypt data for safe transmission
over internet.
 You can send and receive cookies to track
the visitor of your website.
Dynamic Web Page Creation
PHP and MySQL

Advantages of PHP over Other Languages


 Easy to learn: PHP is easy to learn and use.
For beginner programmers who just started
out in web development, PHP is often
considered as the preferable choice of
language to learn.
 Open source: PHP is an open-source project.
It is developed and maintained by a
worldwide community of developers who
make its source code freely available to
download and use.
Dynamic Web Page Creation
PHP and MySQL

Advantages of PHP over Other Languages


 Portability: PHP runs on various platforms
such as Microsoft Windows, Linux, Mac OS, 
etc. and it is compatible with almost all
servers used today such Apache, IIS, etc.
 Fast Performance: Scripts written in PHP
usually execute or runs faster than those
written in other scripting languages like ASP,
Ruby, Python, Java, etc.
Dynamic Web Page Creation
PHP and MySQL

Advantages of PHP over Other Languages


 Vast Community: Since PHP is supported by
the worldwide community, finding help or
documentation related to PHP online is
extremely easy.
Dynamic Web Page Creation
PHP and MySQL

Setting Up a Local Web Server


 PHP script execute on a web server running PHP.
 The Apache Web server
 The PHP engine
 The MySQL database server
 You can either install them individually or choose
a pre-configured package for your operating
system like Linux and Windows. Popular pre-
configured package are XAMPP and WampServer.
Dynamic Web Page Creation
PHP and MySQL

Setting Up a Local Web Server


 PHP script execute on a web server running PHP.
 The Apache Web server
 The PHP engine
 The MySQL database server
 You can either install them individually or choose
a pre-configured package for your operating
system like Linux and Windows. Popular pre-
configured package are XAMPP and WampServer.
Dynamic Web Page Creation
PHP and MySQL

PHP Syntax
 A PHP script starts with the <?php and
ends with the ?> tag.
 Every PHP statement end with a semicolon
(;) — this tells the PHP engine that the end
of the current statement has been
reached.
Dynamic Web Page Creation
PHP and MySQL

PHP Syntax
<?php
// Some code to be executed
echo "Hello, world!";
?>
Dynamic Web Page Creation
PHP and MySQL

Case Sensitivity in PHP


 Variable names in PHP are case-sensitive.
As a result the variables $variable,
$Variable and $VARIABLE are treated as
three different variables.
 However the keywords, function and
classes names are case-insensitive. 
 $get = $GET = $Get
Dynamic Web Page Creation
PHP and MySQL

Variables in PHP
 A variable does not need to be declared before
adding a value to it. PHP automatically converts
the variable to the correct data type, depending
on its value. 
 All variables in PHP start with a $ sign, followed by
the name of the variable.
 A variable name must start with a letter or the
underscore character _.
 A variable name cannot start with a number.
 $var_name = value;
Dynamic Web Page Creation
PHP and MySQL

Variables in PHP
<?php
// Declaring variables
$txt = "Hello World!";
$number = 10;

// Displaying variables value


echo $txt; // Output: Hello World!
echo $number; // Output: 10
?>
Dynamic Web Page Creation
PHP and MySQL

PHP - Operator Types


 Operators are symbols that tell the PHP
processor to perform certain actions
 Arithmetic Operators
 Comparison Operators
 Logical (or Relational) Operators
 Assignment Operators
Dynamic Web Page Creation
PHP and MySQL

Arithmetic Operators
Dynamic Web Page Creation
PHP and MySQL

Assignment Operators
Dynamic Web Page Creation
PHP and MySQL

Comparison Operators
Dynamic Web Page Creation
PHP and MySQL

Logical Operators
Dynamic Web Page Creation
PHP and MySQL

PHP GET and POST
 There are two ways the browser client can
send information to the web server.
 The GET Method
 The POST Method
 Before the browser sends the information,
it encodes it using a scheme called URL
encoding
Dynamic Web Page Creation
PHP and MySQL

PHP GET
 The GET method sends the encoded user
information appended to the page
request. The page and the encoded
information are separated by the ?
character. 
 The GET method produces a long string
that appears in your server logs, in the
browser's Location: box.
http://www.test.com/index.htm?name1=value1&name2=value2
Dynamic Web Page Creation
PHP and MySQL

PHP GET
<form action="get.php" method="GET">
Name:<input type="text" name="name">
<input type="submit" value="Submit">
</form>
<?php
// It will display the data that it was received from the
form called name
// isset — Determine if a variable is declared and is
different than NULL
if (isset($_GET['name'])) {
echo ($_GET['name']); }
?>
Dynamic Web Page Creation
PHP and MySQL

PHP POST
 The POST method transfers information via
HTTP headers and put into a header called
QUERY_STRING.
 The data sent by POST method goes
through HTTP header so security depends
on HTTP protocol.
Dynamic Web Page Creation
PHP and MySQL

PHP POST
<form action=“post.php" method=“POST">
Name:<input type="text" name="name">
<input type="submit" value="Submit">
</form>
<?php
// It will display the data that it was received from the
form called name
// isset — Determine if a variable is declared and is
different than NULL
if (isset($_POST['name'])) {
echo ($_POST['name']); }
?>
Dynamic Web Page Creation
PHP and MySQL

Database
 A database is an organized collection of data,
generally stored and accessed electronically from a
computer system.
 Where databases are more complex they are
often developed using formal design and
modeling techniques.
 A database is a separate application that stores a
collection of data.
Dynamic Web Page Creation
PHP and MySQL

SQL – Structured Query Language


 SQL is a standard language for accessing
and manipulating databases.
SQL Commands
 SQL commands are instructions, coded
into SQL statements, which are used to
communicate with the database to
perform specific tasks, work, functions and
queries with data.
MySQL
My Structured Query Language

Percival
Percival A.
A. Fernandez
Fernandez
Dynamic Web Page Creation
PHP and MySQL

MySQL Database
 MySQL is the most popular database system
used with PHP.
 MySQL is one of the best RDBMS being used
for developing various web-based software
applications.
 MySQL is free and open-source software
 PHP combined with MySQL are cross-platform
(you can develop in Windows and serve on a
Unix platform) 
Dynamic Web Page Creation
PHP and MySQL

MySQL Database
 MySQL is the most popular database
system used with PHP.
 MySQL is one of the best RDBMS being
used for developing various web-based
software applications.
 MySQL is free and open-source software 
Dynamic Web Page Creation
PHP and MySQL

Database Tables
 A database most often contains one or more
tables. Each table is identified by a name (e.g.
"Customers" or "Orders"). Tables contain records
(rows) with data. 
Dynamic Web Page Creation
PHP and MySQL

Data Manipulation Language (DML)


 DML resembles simple English language and
enhances efficient user interaction with the
system. The functional capability of DML is
organized in manipulation commands like
 SELECT
 UPDATE
 INSERT INTO
 DELETE FROM
Dynamic Web Page Creation
PHP and MySQL

Data Manipulation Language (DML)


 SELECT: This command is used to retrieve rows
from a table.
 The syntax is SELECT [column name(s)] from
[table name] where [conditions].

 UPDATE: This command modifies data of one or


more records. An update command syntax is
 UPDATE [table name] SET [column name = value]
where [condition].
Dynamic Web Page Creation
PHP and MySQL

Data Manipulation Language (DML)


 INSERT: This command adds one or more records
to a database table.
 The insert command syntax is INSERT INTO [table
name] [column(s)] VALUES [value(s)].

 DELETE: This command removes one or more


records from a table according to specified
conditions.
 Delete command syntax is DELETE FROM [table
name] where [condition].
Dynamic Web Page Creation
PHP and MySQL

Thank You
References :
• https://www.tutorialrepublic.com/php-tutorial/php-get-started.php
• https://www.tutorialspoint.com/php/php_introduction.htm
• https://www.formget.com/php-post-get/
• https://www.php.net/manual/en/function.isset.php

• https://www.w3schools.com/php/php_mysql_intro.asp
• https://en.wikipedia.org/wiki/MySQL
• https://www.tutorialspoint.com/mysql/

• www.dictionary.com/browse/website
• https://www.techopedia.com/definition/5399/static-web-page

You might also like