SlideShare a Scribd company logo
1 of 57
1. Current trends – WEB Tech…
1. Current trends – WEB Tech…
2. PHP & MySQL – An Introduction
2. PHP & MySQL – An Introduction
3. Getting started
3. Getting started
4. Examples
4. Examples
5. Simple Registration & Login app
5. Simple Registration & Login app
Usage of server-side programming
languages for websites

PHP is now installed on more than

20 million websites and 1 million web servers.
servers
Source : http://w3techs.com
Usage of client-side programming
languages for websites

Source : http://w3techs.com
Usage of markup languages for
websites

Source : http://w3techs.com
What is XHTML ?
1. XHTML is an Extensible HyperText Markup Language
2. XHTML is a combination of HTML and XML
(EXtensible Markup Language)
3. XHTML is almost identical to HTML 4.01 but a stricter
cleaner version. The major differences are:
 XHTML elements must be properly nested.
 XHTML elements must always be closed.
 XHTML elements must be in lowercase.
 XHTML documents must have one root element.
Usage of JavaScript libraries for
websites

Source : http://w3techs.com
PHP: Hypertext Preprocessor
• PHP was created by Rasmus Lerdorf in 1994.
• PHP is a recursive acronym for “PHP: Hypertext
Preprocessor”.
• PHP is powerful server-side scripting language for
creating dynamic and interactive websites.
• PHP is perfectly suited for Web development and can be
embedded directly into the HTML code.
• The PHP syntax is very similar to JavaScript, Perl and C
Language.
PHP Programming Paradigms
Uses both procedural and object oriented
paradigms

• Procedural PHP
 Has been in use since the creation of PHP, its primary
paradigm.
 Allows for easy and quick learning of the PHP
language.
 Similar to other popular languages such as Visual
Basic, C++, and Fortran.

• Object Oriented PHP
 Similar to Java
What is PHP Good For?
• It is great for complex web page designs
 E-commerce sites with heavy traffic (Amazon,Flipkart)
 Secure websites (Paypal)
 Email web hosts (Gmail)
 Database management and search (FaceBook, naukri,
Wikipedia , Flickr )
 Most content management systems such as
WordPress, Drupal, and Joomla are all based on PHP.
PHP Introduction
•

PHP is known as a server-sided language. That's because
the PHP doesn't get executed on your computer, but on the
computer you requested the page from. The results are then
handed over to you, and displayed in your browser.

•

PHP supports many databases ( MySQL, Informix, Oracle,
Sybase, PostgreSQL, Generic ODBC, etc.)

•

It is an open source software, which is widely used and free
to download and use.
PHP Introduction
• PHP code is interpreted by a web server with a PHP
processor module which generates the resulting web page .
• PHP code is executed on the server, generating HTML which
is then sent to the client. The client would receive the results of
running that script, but would not know what the underlying
code was.
PHP Introduction
Why is PHP used?
1. Easy to Use
Code is embedded into HTML. The PHP code is enclosed in
special start and end tags that allow you to jump into and out of
"PHP mode".

<html>
<head>
<title>Brainware Baguiati PHP Example</title>
</head>
<body>

<?php
echo "Hi, I am a PHP script !";
?>
</body>
</html>
Why is PHP used?
2.Cross Platform
Runs on almost any Web server on several operating
systems. One of the strongest features is the wide
range of supported databases.
Web Servers: Apache, Microsoft IIS ,nGinx, etc
Operating Systems: Linux, Mac OSX, Windows
Supported Databases: IBM DB2, Informix, Ingres,
MySQL, ODBC, Oracle, PostgreSQL, SQLite, Sybase
Why is PHP used?
3.Cost Benefits
PHP is free. Open source code means that the entire
PHP community will contribute towards bug fixes.
There are several add-on technologies (libraries) for
PHP that are also free.
Software

Free

Platform

Free (Linux)

Development Tools

Free
PHP Coder, jEdit , Notepad++
Getting Started PHP Hello World

Above is the PHP source code.
PHP Hello World
It renders as HTML that looks like this:
PHP Comments
• All php files are saved with extension .php
• The can be written in notepad or any text
editor
• Single line comment
// this is single line comment

• Multi line comment
/*….
This is a multi line comment */
Variables
 Variables start with a $ symbol - $name , $age , $city
 A variable name can only contain alpha-numeric
characters and underscores (A-z, 0-9, and _ )
 In PHP, a variable does not need to be declared before
adding a value to it.
 PHP is loosely typed language. There is no strict data
typing. PHP automatically converts the variable to the
correct data type, depending on its value.
 Variables are CASE SENSITIVE.
($y and $Y are two different variables)
PHP Conditional Statements
• if statement - use this statement to execute some code only if
a specified condition is true
• if...else statement - use this statement to execute some code
if a condition is true and another code if the condition is false
• if...elseif....else statement - use this statement to select one
of several blocks of code to be executed
• switch statement - use this statement to select one of many
blocks of code to be executed
Conditions
• If else
if(condition) {….}
elseif(condition) {….}
else { ….}

• Switch case
switch(var)
{
case c1: statements;break
……
Default: statements; break;
}
PHP Arrays
• An array variable is a storage area holding
a number or text. The problem is, a variable
will hold only one value.
• An array is a special variable, which can
store multiple values in one single variable.
PHP Arrays
In PHP, there are three kind of arrays:
• Numeric array - An array with a numeric
index
• Associative array - An array where each ID
key is associated with a value
• Multidimensional array - An array containing
one or more arrays
PHP Arrays
• Numeric array - An array with a numeric
index
$students_array[0] = “Rohan”;
$students_array[1] = “Dhruba”;
$students_array[2] = “Rina”;
$students_array[3] = “Tanya”;
echo "Two of my students are " . $students_array[0] . " and " . $students_array[1];
PHP Arrays
• Associative array - An array where each ID
key is associated with a value
$marks[“Rohan”] = 90;
$marks[“Dhruba”] = 80;
$marks[“Rina”] = 65;
$marks[“Tanya”] = 88;
echo "Rohan has secured : " . $marks["Rohan"] . "<br />";
echo "Dhruba has secured :" . $marks["Dhruba"] . "<br />";
echo "Rina has secured : " . $marks["Rina"] . "<br />";
echo "Tanya has secured :" . $marks["Tanya"];
PHP Arrays
• Multidimensional array - An array containing
one or more arrays
$shop = array(

array("rose", 1.25 , 15),
array("daisy", 0.75 , 25),
array("orchid", 1.15 , 7)

);
echo $shop[0][0]." costs ".$shop[0][1]." and you get ".$shop[0][2]."<br />";
echo $shop[1][0]." costs ".$shop[1][1]." and you get ".$shop[1][2]."<br />";
echo $shop[2][0]." costs ".$shop[2][1]." and you get ".$shop[2][2]."<br />";
PHP Loops
• while - loops through a block of code while a
specified condition is true
• do...while - loops through a block of code once,
and then repeats the loop as long as a specified
condition is true
• for - loops through a block of code a specified
number of times
• foreach - loops through a block of code for each
element in an array
Loops

•

for
for(intialisation;condition;increment/decrement)
{ //do this code }
• while
while ( conditional statement is true ) {
//do this code;
}
• do While
do {….} while(conditional statement is true);
a do-while loop first do's and secondly checks the while condition!

•

foreach

$colors = array("red", "green", "blue", "yellow");
foreach ($colors as $value) {
echo "$value <br>";
}
Operators
Operators are used to operate on values.
There are four classifications of operators:

 Arithmetic
 Assignment
 Comparison
 Logical
PHP Operators
PHP Operators
PHP Operators
PHP Operators
Functions and Parameters
• PHP functions need to be defined with key
word function
• It can have zero or more values (parameters)
• Functions may or may not return values
• If a function need to return value, the last
statement of the function should be return
– return value;
Functions
• Parameter less function
<?php
function sayHi()
{
echo “hi”;
}

?>
This can be called as <?php sayHi(); ?>
in the program
Functions
• Parameterized function
<?php
function greet($name)
{
echo “Hello “ . $name;
}

?>
This can be called <?php greet(‘Sachin’);?>
This gives an output Hello Ram
Functions
• Function returning value
<?php
function add($a,$b)
{
return ($a + $b);
}

?>
When called like <?php echo add(1,2);?>
we will get an output 3 in the browser.
Example
The following example shows how to display
content according to the day of the week.
0 (for Sunday) through 6 (for Saturday)
<?php

$today_dayofweek = date (“w”);
if ($today_dayofweek == 0) {
echo “enjoy….. today is Sunday !”;
}
else {
echo “Go to Work…today is not Sunday.”;
}
?>
Complete Example

• Step 1: Universal header and footer in a single file
•

Create a file called header.php. This file will have all of the
header HTML code. Remember to remove the closing </BODY> and
</HTML> tags.

<html><head>
<title>Brainware PHP Workshop</title>
<link rel="stylesheet" type="text/css“
href=“mycssfile.css">
</head>
<body>
<table width=80% border=0>
<tr><td>
<div align=center> Welcome to BRAINWARE </div>
</td></tr>
</table>
Complete Example
• Step 2: Universal header and footer in a single file
• Next, create a file called footer.php. This file will
have all of the footer HTML code
<table width=80% border=0>
<tr><td>
<div align=center> Brainware Baguiati Campus<br/>
<a href=mailto:info@abc.com>Send Us Email</a>
</div>
</td></tr>
</table>
</body>
</html>
Complete Example
•
•

Step 3: Universal header and footer in a single file
This is the basic template that you will use on all of the pages. Make
sure you name the files with a .php extension so that the server will
process the PHP code. In this example, we assume the header and
footer files are located in the same directory.

<?php
// header
include("header.php");
?>
Insert content here!
<?php
// footer
include("footer.php");
?>
Example ( Benefits )
Any changes to header or footer only require editing of a single file. These
changes will take effect in all the pages where header or footer are
included. This reduces the amount of work necessary for site maintenance
and redesign. Helps separate the content and design for easier maintenance
Header

Page 1
Content

Page 2
Content

Page 3
Content

Footer

Page 4
Content

Page 5
Content
PHP Forms - $_GET Function
 The built-in $_GET function is used to collect values from a form sent
with method=“GET”
<form method= "get" action="action.php">
... <input …….
</form>

 GET is better for non-secure data, like query strings in Google
 Information sent from a form with the GET method is visible to everyone
all variable names and values are displayed in the URL

action.php?name=rahul&age=23&qual=btech
This method should not be used when sending passwords or
other sensitive information!
PHP Forms - $_POST Function
• The built-in $_POST function is used to collect
values from a form sent with method=“POST".
<form method="post" action=“action.php">
... <input …….
</form>

• Information sent from a form with the POST method
is invisible to others and has no limits on the amount
of information to send.
• Note: However, there is an 8 Mb max size for the
POST method, by default (can be changed by setting
the post_max_size in the php.ini file).
PHP Database Handling
• PHP can connect to
– MySQL
– Access and other databases
like Oracle, postgre sql, SQL
Server etc

• There are separate
methods available for
connecting to the
databases.
What is MySQL
• MySQL is a database system used on the web that
runs on a server
• MySQL is ideal for both small and large
applications
• MySQL is very fast, reliable, and easy to use
• MySQL supports standard SQL
• MySQL compiles on a number of platforms
• MySQL is free to download and use
• MySQL is developed, distributed, and
supported by Oracle Corporation
Companies using MySQL
MySQL Connection
• mysql_connect(dbserver,userid,password)
is used for connecting to MySQL dbserver using a userid
and password

• $con = mysql_connect(‘localhost’,’root’,’123456’);
This gets a connection to the localhost mysql server
using the credentials root and 123456
If the mysql server cannot be connected, it will throw an error
stating the problem.
MySQL Select DB
• mysql_select_db(database,connection)
Parameter

Description

database

Required. Specifies the database to use.

connection

Optional. Specifies the MySQL connection.

• mysql_select_db(“students”,$con);
– This will select the database students under
the server localhost
– If unable to select the database, an error will
be thrown
MySQL Execute Query
mysql_query(sql query, connection);
This will execute the sql statement on the database and store the
result in a variable.
Parameter

Description

database

Required. Specifies the SQL query to run.

connection

Optional. Specifies the MySQL connection.

Example:

$rs = mysql_query(“select * from students”, $con);
$row = mysql_fetch_array($rs);
–
–
–
–

This will fetch a row from the table and store in $row
Data Values can be accessed like - $row[“age”]
returns value of column age from the database in the fetched row.
$agevar = $row[“age”]
Our Task
Registration and Login
• We will develop a registration and login system
using PHP and MySQL
• We will need two forms, php scripts and a
database
• Database - name “pailan”
• Table – name “mst_facehook”
• Two pages – “registration.html” & “login.html”
• PHP Script – “registration.php” & “login.php”
• That’s it……… Lets start……
Registration and Login
• Database - name “pailan”
• Table – name “mst_facehook”
Field
id
email
password
gender
city

Type
int(10)
varchar(200)
varchar(100)
char(1)
varchar(20)
Registration Page
Login Page
SHOUBHIK ROY / SANDEEP BAJORIA

email : info@brainware-baguiati.com
M : +91 98319 28362 / +91 98309 36993
web : www.brainware-baguiati.com
www.facebook.com/Brainware.Kolkata

More Related Content

What's hot (20)

PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Overview of PHP and MYSQL
Overview of PHP and MYSQLOverview of PHP and MYSQL
Overview of PHP and MYSQL
 
Php basics
Php basicsPhp basics
Php basics
 
Php Crash Course
Php Crash CoursePhp Crash Course
Php Crash Course
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
Php(report)
Php(report)Php(report)
Php(report)
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
 
PHP NOTES FOR BEGGINERS
PHP NOTES FOR BEGGINERSPHP NOTES FOR BEGGINERS
PHP NOTES FOR BEGGINERS
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Php
PhpPhp
Php
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
PHP Basic
PHP BasicPHP Basic
PHP Basic
 
What Is Php
What Is PhpWhat Is Php
What Is Php
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
PHP
PHPPHP
PHP
 
Basic of PHP
Basic of PHPBasic of PHP
Basic of PHP
 

Viewers also liked

Web Server Programming - Chapter 1
Web Server Programming - Chapter 1Web Server Programming - Chapter 1
Web Server Programming - Chapter 1Nicole Ryan
 
Php & mysql course syllabus
Php & mysql course syllabusPhp & mysql course syllabus
Php & mysql course syllabusPapitha Velumani
 
Php Using Arrays
Php Using ArraysPhp Using Arrays
Php Using Arraysmussawir20
 
Php Training
Php TrainingPhp Training
Php Trainingadfa
 
Hong Kong, Second Homecoming & La Liga Filipina
Hong Kong, Second Homecoming  &  La Liga FilipinaHong Kong, Second Homecoming  &  La Liga Filipina
Hong Kong, Second Homecoming & La Liga FilipinaTin-Tin Jamila
 
SocSci- Rizal as a Traveler
SocSci- Rizal as a TravelerSocSci- Rizal as a Traveler
SocSci- Rizal as a TravelerToni Pureza
 
Rizal's life by Cabsag Naisy BSED3
Rizal's life by Cabsag Naisy BSED3Rizal's life by Cabsag Naisy BSED3
Rizal's life by Cabsag Naisy BSED3Levimae Tolentino
 
Environmental principles
Environmental principlesEnvironmental principles
Environmental principlesjanels
 
Importance of Hotels and Tourism in India
Importance of Hotels and Tourism in India Importance of Hotels and Tourism in India
Importance of Hotels and Tourism in India sushmasahupgdthm
 
Epekto ng Oplayn na Laro
Epekto ng Oplayn na LaroEpekto ng Oplayn na Laro
Epekto ng Oplayn na LaroJeno Flores
 
Filipino inside
Filipino insideFilipino inside
Filipino insidejeffkian06
 

Viewers also liked (20)

Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
Web Server Programming - Chapter 1
Web Server Programming - Chapter 1Web Server Programming - Chapter 1
Web Server Programming - Chapter 1
 
Php & mysql course syllabus
Php & mysql course syllabusPhp & mysql course syllabus
Php & mysql course syllabus
 
PHP Web Programming
PHP Web ProgrammingPHP Web Programming
PHP Web Programming
 
Mysql
MysqlMysql
Mysql
 
How To Become A Php Geek
How To Become A Php GeekHow To Become A Php Geek
How To Become A Php Geek
 
Web programming
Web programmingWeb programming
Web programming
 
Php Using Arrays
Php Using ArraysPhp Using Arrays
Php Using Arrays
 
Php Training
Php TrainingPhp Training
Php Training
 
The arrival in manila
The arrival in manilaThe arrival in manila
The arrival in manila
 
Hong Kong, Second Homecoming & La Liga Filipina
Hong Kong, Second Homecoming  &  La Liga FilipinaHong Kong, Second Homecoming  &  La Liga Filipina
Hong Kong, Second Homecoming & La Liga Filipina
 
SocSci- Rizal as a Traveler
SocSci- Rizal as a TravelerSocSci- Rizal as a Traveler
SocSci- Rizal as a Traveler
 
El filibusterismo
El filibusterismoEl filibusterismo
El filibusterismo
 
Rizal's life by Cabsag Naisy BSED3
Rizal's life by Cabsag Naisy BSED3Rizal's life by Cabsag Naisy BSED3
Rizal's life by Cabsag Naisy BSED3
 
Environmental principles
Environmental principlesEnvironmental principles
Environmental principles
 
Importance of Hotels and Tourism in India
Importance of Hotels and Tourism in India Importance of Hotels and Tourism in India
Importance of Hotels and Tourism in India
 
MySQL
MySQLMySQL
MySQL
 
Introduction to MySQL
Introduction to MySQLIntroduction to MySQL
Introduction to MySQL
 
Epekto ng Oplayn na Laro
Epekto ng Oplayn na LaroEpekto ng Oplayn na Laro
Epekto ng Oplayn na Laro
 
Filipino inside
Filipino insideFilipino inside
Filipino inside
 

Similar to PHP & MySQL Web Tech Trends

Similar to PHP & MySQL Web Tech Trends (20)

Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
 
PHP ITCS 323
PHP ITCS 323PHP ITCS 323
PHP ITCS 323
 
Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1Web Application Development using PHP Chapter 1
Web Application Development using PHP Chapter 1
 
Php training100%placement-in-mumbai
Php training100%placement-in-mumbaiPhp training100%placement-in-mumbai
Php training100%placement-in-mumbai
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
 
Php Basics
Php BasicsPhp Basics
Php Basics
 
Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)
Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)
Php i basic chapter 3 (mardhiah kamaludin's conflicted copy 2013-04-23)
 
Php unit i
Php unit iPhp unit i
Php unit i
 
Hsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdfHsc IT 5. Server-Side Scripting (PHP).pdf
Hsc IT 5. Server-Side Scripting (PHP).pdf
 
Prersentation
PrersentationPrersentation
Prersentation
 
Php reports sumit
Php reports sumitPhp reports sumit
Php reports sumit
 
PHP - Introduction to PHP Fundamentals
PHP -  Introduction to PHP FundamentalsPHP -  Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
 
php 1
php 1php 1
php 1
 
Introduction to PHP.pptx
Introduction to PHP.pptxIntroduction to PHP.pptx
Introduction to PHP.pptx
 
Materi Dasar PHP
Materi Dasar PHPMateri Dasar PHP
Materi Dasar PHP
 
Introduction to php
Introduction to phpIntroduction to php
Introduction to php
 
Php introduction
Php introductionPhp introduction
Php introduction
 

Recently uploaded

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Recently uploaded (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

PHP & MySQL Web Tech Trends

  • 1. 1. Current trends – WEB Tech… 1. Current trends – WEB Tech… 2. PHP & MySQL – An Introduction 2. PHP & MySQL – An Introduction 3. Getting started 3. Getting started 4. Examples 4. Examples 5. Simple Registration & Login app 5. Simple Registration & Login app
  • 2. Usage of server-side programming languages for websites PHP is now installed on more than 20 million websites and 1 million web servers. servers Source : http://w3techs.com
  • 3. Usage of client-side programming languages for websites Source : http://w3techs.com
  • 4. Usage of markup languages for websites Source : http://w3techs.com
  • 5. What is XHTML ? 1. XHTML is an Extensible HyperText Markup Language 2. XHTML is a combination of HTML and XML (EXtensible Markup Language) 3. XHTML is almost identical to HTML 4.01 but a stricter cleaner version. The major differences are:  XHTML elements must be properly nested.  XHTML elements must always be closed.  XHTML elements must be in lowercase.  XHTML documents must have one root element.
  • 6. Usage of JavaScript libraries for websites Source : http://w3techs.com
  • 7. PHP: Hypertext Preprocessor • PHP was created by Rasmus Lerdorf in 1994. • PHP is a recursive acronym for “PHP: Hypertext Preprocessor”. • PHP is powerful server-side scripting language for creating dynamic and interactive websites. • PHP is perfectly suited for Web development and can be embedded directly into the HTML code. • The PHP syntax is very similar to JavaScript, Perl and C Language.
  • 8. PHP Programming Paradigms Uses both procedural and object oriented paradigms • Procedural PHP  Has been in use since the creation of PHP, its primary paradigm.  Allows for easy and quick learning of the PHP language.  Similar to other popular languages such as Visual Basic, C++, and Fortran. • Object Oriented PHP  Similar to Java
  • 9. What is PHP Good For? • It is great for complex web page designs  E-commerce sites with heavy traffic (Amazon,Flipkart)  Secure websites (Paypal)  Email web hosts (Gmail)  Database management and search (FaceBook, naukri, Wikipedia , Flickr )  Most content management systems such as WordPress, Drupal, and Joomla are all based on PHP.
  • 10. PHP Introduction • PHP is known as a server-sided language. That's because the PHP doesn't get executed on your computer, but on the computer you requested the page from. The results are then handed over to you, and displayed in your browser. • PHP supports many databases ( MySQL, Informix, Oracle, Sybase, PostgreSQL, Generic ODBC, etc.) • It is an open source software, which is widely used and free to download and use.
  • 11. PHP Introduction • PHP code is interpreted by a web server with a PHP processor module which generates the resulting web page . • PHP code is executed on the server, generating HTML which is then sent to the client. The client would receive the results of running that script, but would not know what the underlying code was.
  • 13. Why is PHP used? 1. Easy to Use Code is embedded into HTML. The PHP code is enclosed in special start and end tags that allow you to jump into and out of "PHP mode". <html> <head> <title>Brainware Baguiati PHP Example</title> </head> <body> <?php echo "Hi, I am a PHP script !"; ?> </body> </html>
  • 14. Why is PHP used? 2.Cross Platform Runs on almost any Web server on several operating systems. One of the strongest features is the wide range of supported databases. Web Servers: Apache, Microsoft IIS ,nGinx, etc Operating Systems: Linux, Mac OSX, Windows Supported Databases: IBM DB2, Informix, Ingres, MySQL, ODBC, Oracle, PostgreSQL, SQLite, Sybase
  • 15. Why is PHP used? 3.Cost Benefits PHP is free. Open source code means that the entire PHP community will contribute towards bug fixes. There are several add-on technologies (libraries) for PHP that are also free. Software Free Platform Free (Linux) Development Tools Free PHP Coder, jEdit , Notepad++
  • 16. Getting Started PHP Hello World Above is the PHP source code.
  • 17. PHP Hello World It renders as HTML that looks like this:
  • 18. PHP Comments • All php files are saved with extension .php • The can be written in notepad or any text editor • Single line comment // this is single line comment • Multi line comment /*…. This is a multi line comment */
  • 19. Variables  Variables start with a $ symbol - $name , $age , $city  A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )  In PHP, a variable does not need to be declared before adding a value to it.  PHP is loosely typed language. There is no strict data typing. PHP automatically converts the variable to the correct data type, depending on its value.  Variables are CASE SENSITIVE. ($y and $Y are two different variables)
  • 20. PHP Conditional Statements • if statement - use this statement to execute some code only if a specified condition is true • if...else statement - use this statement to execute some code if a condition is true and another code if the condition is false • if...elseif....else statement - use this statement to select one of several blocks of code to be executed • switch statement - use this statement to select one of many blocks of code to be executed
  • 21. Conditions • If else if(condition) {….} elseif(condition) {….} else { ….} • Switch case switch(var) { case c1: statements;break …… Default: statements; break; }
  • 22. PHP Arrays • An array variable is a storage area holding a number or text. The problem is, a variable will hold only one value. • An array is a special variable, which can store multiple values in one single variable.
  • 23. PHP Arrays In PHP, there are three kind of arrays: • Numeric array - An array with a numeric index • Associative array - An array where each ID key is associated with a value • Multidimensional array - An array containing one or more arrays
  • 24. PHP Arrays • Numeric array - An array with a numeric index $students_array[0] = “Rohan”; $students_array[1] = “Dhruba”; $students_array[2] = “Rina”; $students_array[3] = “Tanya”; echo "Two of my students are " . $students_array[0] . " and " . $students_array[1];
  • 25. PHP Arrays • Associative array - An array where each ID key is associated with a value $marks[“Rohan”] = 90; $marks[“Dhruba”] = 80; $marks[“Rina”] = 65; $marks[“Tanya”] = 88; echo "Rohan has secured : " . $marks["Rohan"] . "<br />"; echo "Dhruba has secured :" . $marks["Dhruba"] . "<br />"; echo "Rina has secured : " . $marks["Rina"] . "<br />"; echo "Tanya has secured :" . $marks["Tanya"];
  • 26. PHP Arrays • Multidimensional array - An array containing one or more arrays $shop = array( array("rose", 1.25 , 15), array("daisy", 0.75 , 25), array("orchid", 1.15 , 7) ); echo $shop[0][0]." costs ".$shop[0][1]." and you get ".$shop[0][2]."<br />"; echo $shop[1][0]." costs ".$shop[1][1]." and you get ".$shop[1][2]."<br />"; echo $shop[2][0]." costs ".$shop[2][1]." and you get ".$shop[2][2]."<br />";
  • 27. PHP Loops • while - loops through a block of code while a specified condition is true • do...while - loops through a block of code once, and then repeats the loop as long as a specified condition is true • for - loops through a block of code a specified number of times • foreach - loops through a block of code for each element in an array
  • 28. Loops • for for(intialisation;condition;increment/decrement) { //do this code } • while while ( conditional statement is true ) { //do this code; } • do While do {….} while(conditional statement is true); a do-while loop first do's and secondly checks the while condition! • foreach $colors = array("red", "green", "blue", "yellow"); foreach ($colors as $value) { echo "$value <br>"; }
  • 29. Operators Operators are used to operate on values. There are four classifications of operators:  Arithmetic  Assignment  Comparison  Logical
  • 34. Functions and Parameters • PHP functions need to be defined with key word function • It can have zero or more values (parameters) • Functions may or may not return values • If a function need to return value, the last statement of the function should be return – return value;
  • 35. Functions • Parameter less function <?php function sayHi() { echo “hi”; } ?> This can be called as <?php sayHi(); ?> in the program
  • 36. Functions • Parameterized function <?php function greet($name) { echo “Hello “ . $name; } ?> This can be called <?php greet(‘Sachin’);?> This gives an output Hello Ram
  • 37. Functions • Function returning value <?php function add($a,$b) { return ($a + $b); } ?> When called like <?php echo add(1,2);?> we will get an output 3 in the browser.
  • 38. Example The following example shows how to display content according to the day of the week. 0 (for Sunday) through 6 (for Saturday) <?php $today_dayofweek = date (“w”); if ($today_dayofweek == 0) { echo “enjoy….. today is Sunday !”; } else { echo “Go to Work…today is not Sunday.”; } ?>
  • 39. Complete Example • Step 1: Universal header and footer in a single file • Create a file called header.php. This file will have all of the header HTML code. Remember to remove the closing </BODY> and </HTML> tags. <html><head> <title>Brainware PHP Workshop</title> <link rel="stylesheet" type="text/css“ href=“mycssfile.css"> </head> <body> <table width=80% border=0> <tr><td> <div align=center> Welcome to BRAINWARE </div> </td></tr> </table>
  • 40. Complete Example • Step 2: Universal header and footer in a single file • Next, create a file called footer.php. This file will have all of the footer HTML code <table width=80% border=0> <tr><td> <div align=center> Brainware Baguiati Campus<br/> <a href=mailto:info@abc.com>Send Us Email</a> </div> </td></tr> </table> </body> </html>
  • 41. Complete Example • • Step 3: Universal header and footer in a single file This is the basic template that you will use on all of the pages. Make sure you name the files with a .php extension so that the server will process the PHP code. In this example, we assume the header and footer files are located in the same directory. <?php // header include("header.php"); ?> Insert content here! <?php // footer include("footer.php"); ?>
  • 42. Example ( Benefits ) Any changes to header or footer only require editing of a single file. These changes will take effect in all the pages where header or footer are included. This reduces the amount of work necessary for site maintenance and redesign. Helps separate the content and design for easier maintenance Header Page 1 Content Page 2 Content Page 3 Content Footer Page 4 Content Page 5 Content
  • 43. PHP Forms - $_GET Function  The built-in $_GET function is used to collect values from a form sent with method=“GET” <form method= "get" action="action.php"> ... <input ……. </form>  GET is better for non-secure data, like query strings in Google  Information sent from a form with the GET method is visible to everyone all variable names and values are displayed in the URL action.php?name=rahul&age=23&qual=btech This method should not be used when sending passwords or other sensitive information!
  • 44. PHP Forms - $_POST Function • The built-in $_POST function is used to collect values from a form sent with method=“POST". <form method="post" action=“action.php"> ... <input ……. </form> • Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. • Note: However, there is an 8 Mb max size for the POST method, by default (can be changed by setting the post_max_size in the php.ini file).
  • 45. PHP Database Handling • PHP can connect to – MySQL – Access and other databases like Oracle, postgre sql, SQL Server etc • There are separate methods available for connecting to the databases.
  • 46. What is MySQL • MySQL is a database system used on the web that runs on a server • MySQL is ideal for both small and large applications • MySQL is very fast, reliable, and easy to use • MySQL supports standard SQL • MySQL compiles on a number of platforms • MySQL is free to download and use • MySQL is developed, distributed, and supported by Oracle Corporation
  • 48. MySQL Connection • mysql_connect(dbserver,userid,password) is used for connecting to MySQL dbserver using a userid and password • $con = mysql_connect(‘localhost’,’root’,’123456’); This gets a connection to the localhost mysql server using the credentials root and 123456 If the mysql server cannot be connected, it will throw an error stating the problem.
  • 49. MySQL Select DB • mysql_select_db(database,connection) Parameter Description database Required. Specifies the database to use. connection Optional. Specifies the MySQL connection. • mysql_select_db(“students”,$con); – This will select the database students under the server localhost – If unable to select the database, an error will be thrown
  • 50. MySQL Execute Query mysql_query(sql query, connection); This will execute the sql statement on the database and store the result in a variable. Parameter Description database Required. Specifies the SQL query to run. connection Optional. Specifies the MySQL connection. Example: $rs = mysql_query(“select * from students”, $con); $row = mysql_fetch_array($rs); – – – – This will fetch a row from the table and store in $row Data Values can be accessed like - $row[“age”] returns value of column age from the database in the fetched row. $agevar = $row[“age”]
  • 52. Registration and Login • We will develop a registration and login system using PHP and MySQL • We will need two forms, php scripts and a database • Database - name “pailan” • Table – name “mst_facehook” • Two pages – “registration.html” & “login.html” • PHP Script – “registration.php” & “login.php” • That’s it……… Lets start……
  • 53. Registration and Login • Database - name “pailan” • Table – name “mst_facehook” Field id email password gender city Type int(10) varchar(200) varchar(100) char(1) varchar(20)
  • 56.
  • 57. SHOUBHIK ROY / SANDEEP BAJORIA email : info@brainware-baguiati.com M : +91 98319 28362 / +91 98309 36993 web : www.brainware-baguiati.com www.facebook.com/Brainware.Kolkata

Editor's Notes

  1. int value can be -2147483648 these are 11 digits so default size is 11 unsigned int does not allow negative numbers so default size is 10 An INT will always be 4 bytes no matter what length is specified. TINYINT = 1 byte SMALLINT = 2 bytes MEDIUMINT = 3 bytes INT = 4 bytes BIGINT = 8 bytes.