PHP Tuts
PHP Tuts
Page Creation
PHP and MySQL
Percival
Percival A.
A. Fernandez
Fernandez
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 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
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;
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
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
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