SlideShare a Scribd company logo
M D ANANDA RAJ,
Assistant Professor,
Department of computer science
Loyola College, chennai-600 034
profmdloyola@gmail.com
8/3/2017 1
Introduction to
Web Programming using
PHPand MYSQL
Contents
• Introduction
• History
• Important concepts
• Php
• Mysql
• Database concepts
8/3/2017 2
What is Scripting language?
• Scripting language is the one which is used to
develop contents in the web
• Write the code by using predefined tags
<html> contents </html>
• Example :
• HTML, JAVASCRIPT, VBSCRIPT, CSS , XML
8/3/2017 3
What is Client & Server
Client:
client is the system which is looking for
some service
Eg: the system end user using in the lab
Server:
server is the system which is providing
service for the clients (end user)
Eg: server in the computer lab
8/3/2017 4
Client side…
• Client side scripting language executed from
the client machine(System)
example : HTML , CSS, JAVASCRIPT, VBSCRIPT
- Not secured
- any user can view the original by seeing the
view source option in the browser
- any user can view the source code
and modify
8/3/2017 5
Server side …
• Server side scripting language executed from the
server machine(System)
example : ASP , PHP , JSP
- Very much secured
- User cannot view the original source code by
seeing the view source option in the browser it
will show only the html code
- user cannot modify the source code
8/3/2017 6
web contents
• Web can be classified in to two types
1.static page
-contents will not change remain as it is
-user input interaction not possible
2. Dynamic page :
- Contents can be updated very easily
- user input and interaction is possible
8/3/2017 7
What is Open source?
• In software development Open source is the
concept or philosophy that promotes free
distribution of software product without any
license fees.
• Example: open source
• Operating System: Linux
• Script language : PHP,PERL, PYTHON
• Browser : Mozilla Firefox
• Photo Editor : GIMP
• Office : Open Office
8/3/2017 8
Open source development model
View/Modify the source code of an application or software.
he source code of an application or software.
Open source software is released to the development community
and undergoes a secondary phase of evolution, but closed source
software is developed in isolation with a small team of developers.
Developer support and large community to help.
Open Source is more secure and bugs and vulnerabilities are fixed
often.
 source software is released to the development community and
undergoes a secondary phase of evolution, but closed source
software is developed in isolation with a small team of developers.
Developer support and large community to help.
Open Source is more secure and bugs and vulnerabilities are fixed
often.
8/3/2017 9
Advantages…
• Free source code
• No need pay license fees
• No need to depend on vendors
• Easy to fix the error with online support
• Support from forum all around the world
• Updated software version
• Quality and customizable software
• Cost cheaper than licensed software
8/3/2017 10
Disadvantages…
• Users need to update very frequently
• Incompatibility issue with software and
hardware
• Bad codes
• Software quality assurance process is not
transparent
• No financial benefit for the developers
8/3/2017 11
What is wamp?
• WAMP is a web server used to execute php
and mysql in client machine
• A- APACHE
• M- MySQL
• P- PHP
• W- WINDOWS
It is “ APACHE MYSQL PHP FOR WINDOWS
LAMP : APACHE MYSQL PHP FOR LINUX
8/3/2017 12
WAMP ARCHITECTURE…
8/3/2017 13
PHP-Introduction
• PHP == ‘Hypertext Preprocessor’
• Open-source, server-side scripting language
• Used to generate dynamic web-pages
• PHP scripts reside between reserved PHP
tags
– This allows the programmer to embed PHP
scripts within HTML page
– Free to download and use
8/3/2017 14
Overview of PHP…
• Easy learning
• Syntax Perl- and C-like syntax. Relatively easy
to learn.
• Large function library
• Embedded directly into HTML
• Interpreted, no need to compile
• Supports many databases like oracle, MySQL
etc
8/3/2017 15
Php…
• Interpreted language, scripts are parsed at
run-time rather than compiled
• Executed on the server-side
• Source-code not visible by client
– ‘View Source’ in browsers does not display the PHP code
• Various built-in functions allow for fast
development
• Compatible with many popular databases
8/3/2017 16
History of php…
In 1994 developed by Rasmus Lerdorf developed
he called the Personal Home Page or PHP
PHP 2 released 1997 (PHP now stands for
Hypertext Processor)
PHP3 released in 1998 (2 versions)
PHP4 released in 2000 (6 versions).
PHP5.0.0 released July 13, 2004 (1000s of
libraries and functions
PHP5.0.5 released Sept. 6, 2005 for maintenance
and bug fixes (21 versions)
PHP 6.0 is the latest version
8/3/2017 17
Features of php…
• Simplicity
• Portability
• Speed
• Open source
• Extensible
• Database support
8/3/2017 18
Hello.php
• Open the note pad
<html>
<?php
Echo “hello good morning”;
?>
</html>
Save this code as hello.php under
c:wampwwwanandhello.php
8/3/2017 19
Data types supported by PHP:
• Integers 0,1,2,3etc
• Float/ Double – real numbers 0.1, 0.2, 0.3, etc
• String – ‘A’, “Loyola College” etc
• Boolean – True or False
• Array – set of values – {0,1,2,3}or
{0.1,0.2,0.3}or {‘A’, ‘B’, ‘C’} or {“kumar”,
Santhosh”, “Karthick”} etc
8/3/2017 20
Variable declaration
Variables are used for storing values, such as numbers, strings or
function results, so that they can be used many times in a script .All
variables in PHP start with a $ sign symbol.
Syntax:
$var_name = value;
<?php
$txt = "Hello World!";
$number = 16;
?>
Note : PHP a variable does not need to be declared before being
set.PHP automatically converts the variable to the correct data
type, depending on how they are set.
8/3/2017 21
PHP Variable….
• PHP variables must begin with a “$” sign
• Case-sensitive ($Name != $NAME != $NaMe)
• Global and locally-scoped variables
– Global variables can be used anywhere
– Local variables restricted to a function or class
• Certain variable names reserved by PHP
– Form variables ($_POST, $_GET)
– Server variables ($_SERVER)
– Etc.
8/3/2017 22
constants
• PHP constants: Constants are like variables
except that once they are defined they cannot
be changed or undefined. The value cannot be
changed during the script.
• Eg:
<?php
define("MSG", “good morning");
echo MSG;
?>
8/3/2017 23
Looping
• Most of the time when we write code, we want the same
block of code to run a number of times for this purpose we
can use looping statements code to perform this task.
• PHP supports the following:
• while - loops through a block of code if and as long as a
specified condition is true
• do...while - loops through a block of code once, and then
repeats the loop as long as a special 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
8/3/2017 24
Example for each
• Example:
<?php
$arr=array("one", "two", "three");
foreach ($arr as $value)
{
echo "Value: " . $value . "<br />";
?>
8/3/2017 25
cookies
• A cookie is often used to identify a user. A
cookie is a small file that the server embeds
on the user's computer.
• Each time the same computer requests a
page with a browser, it will send the cookie
too.
• With PHP, you can both create and retrieve
cookie values.
8/3/2017 26
What is a PHP Session?
• When you work with an application, you open it, do
some changes, and then you close it. This is much like a
Session. The computer knows who you are. It knows
when you start the application and when you end
• Session variables solve this problem by storing user
information to be used across multiple pages (e.g.
username, password etc). By default, session variables
last until the user closes the browser.
• Session variables hold information about one single
user, and are available to all pages in one application.
8/3/2017 27
MySQL…
MySQL, the most popular Open Source SQL database
management system
It is developed and supported by MySQL AB. MySQL AB is a
commercial company, founded in 1995 by the MySQL
developers.
The MySQL® software delivers a very fast, multi-threaded,
multi-user, and robust SQL (Structured Query Language)
database server.
The MySQL software is Dual Licensed. Users can choose to
use the MySQL software as an Open Source product and
also as commericial licence
8/3/2017 28
MySQL…
• MySQL is a very popular, open source
database.
• Officially pronounced “my Ess Que Ell” (not
my sequel).
• Handles very large databases; very fast
performance.
8/3/2017 29
MySQL storage engines…
• MyISAM –default engine
• InnoDB – features like foreign key,locking
• MERGE – integration of table
• MEMORY (HEAP) – suit for short time storage
• BDB (BerkeleyDB)- hash based storage
• EXAMPLE – used for programmers
• ARCHIVE –to store large amount of data
• CSV – to store data in text files
• BLACKHOLE –only for testing purpose
• ISAM – to store non transactional tables
8/3/2017 30
THANK YOU8/3/2017 31

More Related Content

Similar to Introduction to webprogramming using PHP and MySQL (20)

PPTX
PHP Hypertext Preprocessor
adeel990
 
PPT
Php unit i
prakashvs7
 
ODP
PHP BASIC PRESENTATION
krutitrivedi
 
PPTX
Chapter onehsfhjfgjhdjhdhfsGfhghsgasg (2).pptx
berihun18
 
PPTX
Php reports sumit
Sumit Biswas
 
PDF
PHP Basics
Roohul Amin
 
PPTX
PHP ITCS 323
Sleepy Head
 
PPTX
PHP language presentation
Annujj Agrawaal
 
PPT
PHP and MySQL
bmani
 
PDF
Web Design & Development - Session 7
Shahrzad Peyman
 
PPTX
Php unit i
BagavathiLakshmi
 
PPTX
Php introduction and configuration
Vijay Kumar Verma
 
PPT
Osp ii presentation
presse_jkp
 
PPTX
Lecture1 introduction by okello erick
okelloerick
 
PPTX
Web programming using PHP and Introduction with sample codes
DivyaKS12
 
PPTX
Introduction to php
shanmukhareddy dasi
 
PDF
4 Basic PHP
Jalpesh Vasa
 
PPTX
php.pptx
nusky ahamed
 
PPT
slidesharenew1
truptitasol
 
PPT
sdfsdfsdf
truptitasol
 
PHP Hypertext Preprocessor
adeel990
 
Php unit i
prakashvs7
 
PHP BASIC PRESENTATION
krutitrivedi
 
Chapter onehsfhjfgjhdjhdhfsGfhghsgasg (2).pptx
berihun18
 
Php reports sumit
Sumit Biswas
 
PHP Basics
Roohul Amin
 
PHP ITCS 323
Sleepy Head
 
PHP language presentation
Annujj Agrawaal
 
PHP and MySQL
bmani
 
Web Design & Development - Session 7
Shahrzad Peyman
 
Php unit i
BagavathiLakshmi
 
Php introduction and configuration
Vijay Kumar Verma
 
Osp ii presentation
presse_jkp
 
Lecture1 introduction by okello erick
okelloerick
 
Web programming using PHP and Introduction with sample codes
DivyaKS12
 
Introduction to php
shanmukhareddy dasi
 
4 Basic PHP
Jalpesh Vasa
 
php.pptx
nusky ahamed
 
slidesharenew1
truptitasol
 
sdfsdfsdf
truptitasol
 

Recently uploaded (20)

PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PDF
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PPTX
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Digger Solo: Semantic search and maps for your local files
seanpedersen96
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Empower Your Tech Vision- Why Businesses Prefer to Hire Remote Developers fro...
logixshapers59
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
Agentic Automation: Build & Deploy Your First UiPath Agent
klpathrudu
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Tally software_Introduction_Presentation
AditiBansal54083
 
Ad

Introduction to webprogramming using PHP and MySQL

  • 1. M D ANANDA RAJ, Assistant Professor, Department of computer science Loyola College, chennai-600 034 [email protected] 8/3/2017 1 Introduction to Web Programming using PHPand MYSQL
  • 2. Contents • Introduction • History • Important concepts • Php • Mysql • Database concepts 8/3/2017 2
  • 3. What is Scripting language? • Scripting language is the one which is used to develop contents in the web • Write the code by using predefined tags <html> contents </html> • Example : • HTML, JAVASCRIPT, VBSCRIPT, CSS , XML 8/3/2017 3
  • 4. What is Client & Server Client: client is the system which is looking for some service Eg: the system end user using in the lab Server: server is the system which is providing service for the clients (end user) Eg: server in the computer lab 8/3/2017 4
  • 5. Client side… • Client side scripting language executed from the client machine(System) example : HTML , CSS, JAVASCRIPT, VBSCRIPT - Not secured - any user can view the original by seeing the view source option in the browser - any user can view the source code and modify 8/3/2017 5
  • 6. Server side … • Server side scripting language executed from the server machine(System) example : ASP , PHP , JSP - Very much secured - User cannot view the original source code by seeing the view source option in the browser it will show only the html code - user cannot modify the source code 8/3/2017 6
  • 7. web contents • Web can be classified in to two types 1.static page -contents will not change remain as it is -user input interaction not possible 2. Dynamic page : - Contents can be updated very easily - user input and interaction is possible 8/3/2017 7
  • 8. What is Open source? • In software development Open source is the concept or philosophy that promotes free distribution of software product without any license fees. • Example: open source • Operating System: Linux • Script language : PHP,PERL, PYTHON • Browser : Mozilla Firefox • Photo Editor : GIMP • Office : Open Office 8/3/2017 8
  • 9. Open source development model View/Modify the source code of an application or software. he source code of an application or software. Open source software is released to the development community and undergoes a secondary phase of evolution, but closed source software is developed in isolation with a small team of developers. Developer support and large community to help. Open Source is more secure and bugs and vulnerabilities are fixed often.  source software is released to the development community and undergoes a secondary phase of evolution, but closed source software is developed in isolation with a small team of developers. Developer support and large community to help. Open Source is more secure and bugs and vulnerabilities are fixed often. 8/3/2017 9
  • 10. Advantages… • Free source code • No need pay license fees • No need to depend on vendors • Easy to fix the error with online support • Support from forum all around the world • Updated software version • Quality and customizable software • Cost cheaper than licensed software 8/3/2017 10
  • 11. Disadvantages… • Users need to update very frequently • Incompatibility issue with software and hardware • Bad codes • Software quality assurance process is not transparent • No financial benefit for the developers 8/3/2017 11
  • 12. What is wamp? • WAMP is a web server used to execute php and mysql in client machine • A- APACHE • M- MySQL • P- PHP • W- WINDOWS It is “ APACHE MYSQL PHP FOR WINDOWS LAMP : APACHE MYSQL PHP FOR LINUX 8/3/2017 12
  • 14. PHP-Introduction • PHP == ‘Hypertext Preprocessor’ • Open-source, server-side scripting language • Used to generate dynamic web-pages • PHP scripts reside between reserved PHP tags – This allows the programmer to embed PHP scripts within HTML page – Free to download and use 8/3/2017 14
  • 15. Overview of PHP… • Easy learning • Syntax Perl- and C-like syntax. Relatively easy to learn. • Large function library • Embedded directly into HTML • Interpreted, no need to compile • Supports many databases like oracle, MySQL etc 8/3/2017 15
  • 16. Php… • Interpreted language, scripts are parsed at run-time rather than compiled • Executed on the server-side • Source-code not visible by client – ‘View Source’ in browsers does not display the PHP code • Various built-in functions allow for fast development • Compatible with many popular databases 8/3/2017 16
  • 17. History of php… In 1994 developed by Rasmus Lerdorf developed he called the Personal Home Page or PHP PHP 2 released 1997 (PHP now stands for Hypertext Processor) PHP3 released in 1998 (2 versions) PHP4 released in 2000 (6 versions). PHP5.0.0 released July 13, 2004 (1000s of libraries and functions PHP5.0.5 released Sept. 6, 2005 for maintenance and bug fixes (21 versions) PHP 6.0 is the latest version 8/3/2017 17
  • 18. Features of php… • Simplicity • Portability • Speed • Open source • Extensible • Database support 8/3/2017 18
  • 19. Hello.php • Open the note pad <html> <?php Echo “hello good morning”; ?> </html> Save this code as hello.php under c:wampwwwanandhello.php 8/3/2017 19
  • 20. Data types supported by PHP: • Integers 0,1,2,3etc • Float/ Double – real numbers 0.1, 0.2, 0.3, etc • String – ‘A’, “Loyola College” etc • Boolean – True or False • Array – set of values – {0,1,2,3}or {0.1,0.2,0.3}or {‘A’, ‘B’, ‘C’} or {“kumar”, Santhosh”, “Karthick”} etc 8/3/2017 20
  • 21. Variable declaration Variables are used for storing values, such as numbers, strings or function results, so that they can be used many times in a script .All variables in PHP start with a $ sign symbol. Syntax: $var_name = value; <?php $txt = "Hello World!"; $number = 16; ?> Note : PHP a variable does not need to be declared before being set.PHP automatically converts the variable to the correct data type, depending on how they are set. 8/3/2017 21
  • 22. PHP Variable…. • PHP variables must begin with a “$” sign • Case-sensitive ($Name != $NAME != $NaMe) • Global and locally-scoped variables – Global variables can be used anywhere – Local variables restricted to a function or class • Certain variable names reserved by PHP – Form variables ($_POST, $_GET) – Server variables ($_SERVER) – Etc. 8/3/2017 22
  • 23. constants • PHP constants: Constants are like variables except that once they are defined they cannot be changed or undefined. The value cannot be changed during the script. • Eg: <?php define("MSG", “good morning"); echo MSG; ?> 8/3/2017 23
  • 24. Looping • Most of the time when we write code, we want the same block of code to run a number of times for this purpose we can use looping statements code to perform this task. • PHP supports the following: • while - loops through a block of code if and as long as a specified condition is true • do...while - loops through a block of code once, and then repeats the loop as long as a special 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 8/3/2017 24
  • 25. Example for each • Example: <?php $arr=array("one", "two", "three"); foreach ($arr as $value) { echo "Value: " . $value . "<br />"; ?> 8/3/2017 25
  • 26. cookies • A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. • Each time the same computer requests a page with a browser, it will send the cookie too. • With PHP, you can both create and retrieve cookie values. 8/3/2017 26
  • 27. What is a PHP Session? • When you work with an application, you open it, do some changes, and then you close it. This is much like a Session. The computer knows who you are. It knows when you start the application and when you end • Session variables solve this problem by storing user information to be used across multiple pages (e.g. username, password etc). By default, session variables last until the user closes the browser. • Session variables hold information about one single user, and are available to all pages in one application. 8/3/2017 27
  • 28. MySQL… MySQL, the most popular Open Source SQL database management system It is developed and supported by MySQL AB. MySQL AB is a commercial company, founded in 1995 by the MySQL developers. The MySQL® software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. The MySQL software is Dual Licensed. Users can choose to use the MySQL software as an Open Source product and also as commericial licence 8/3/2017 28
  • 29. MySQL… • MySQL is a very popular, open source database. • Officially pronounced “my Ess Que Ell” (not my sequel). • Handles very large databases; very fast performance. 8/3/2017 29
  • 30. MySQL storage engines… • MyISAM –default engine • InnoDB – features like foreign key,locking • MERGE – integration of table • MEMORY (HEAP) – suit for short time storage • BDB (BerkeleyDB)- hash based storage • EXAMPLE – used for programmers • ARCHIVE –to store large amount of data • CSV – to store data in text files • BLACKHOLE –only for testing purpose • ISAM – to store non transactional tables 8/3/2017 30