Introduction to Web and PHP MySQL PowerPoint PPT Presentation

presentation player overlay
About This Presentation
Transcript and Presenter's Notes

Title: Introduction to Web and PHP MySQL


1
By Programmer Blog

http//programmerblog.net/
Introduction to World Wide Web and basics of
PHP By http//programmerblog.net
2
ProgrammerBlog.Net

http//programmerblog.net/
What is Internet and World Wide Web?
  • Internet Global system of interconnected
    networks
  • It is a network of networks that consists of
    millions of private, public, academic, business,
    and government networks of local to global scope.
  • Use TCP/IP to serve billions of users worldwide.
  • Voice over Internet Protocol (VoIP) and IPTV.
    Newspaper publishing, blogging, and web feeds.
  • Human interactions through instant messaging,
    Internet forums, and social networking sites.
  • www Collection of interconnected documents and
    other resources
  • System of interlinked hypertext documents
    contained on the Internet.
  • http Hyper Text Transfer Protocol
  • Hyperlink (or link) is a reference to a document
    that the reader can directly follow.
  • Hypertext is text displayed with references
    (hyperlinks) to other text that the reader can
    immediately access
  • Protocol to transfer hypertext docs from server
    to client.

3
Web Application Development
ProgrammerBlog.Net

http//programmerblog.net/
  • Web application development is the process and
    practice of developing web applications.
  • Request / Response Model
  • In HTTP, web browsers or spiders typically act as
    clients, while an application running on the
    computer hosting the web site acts as a server
  • Static vs. Dynamic web pages
  • Server Side Scripting Languages
  • J.S.P, ASP. Net Cold Fusion, Python, PHP

4
ProgrammerBlog.Net

http//programmerblog.net/
W.A.M.P Installation
  • On windows WAMP or XAMPP can be installed
  • Web Server Apache
  • Server Side Language PHP
  • DBMS MySql
  • PhpMyAdmin

5
ProgrammerBlog.Net

http//programmerblog.net/
PHP History
  • Rasmus Lerdorf - Creator of PHP language
  • PHP - 1995 Collection of Perl/CGI scripts
  • PHP/FI was created by Rasmus Lerdorf in 1995,
    initially as a simple set of Perl scripts for
    tracking accesses to his online resume
  • PHP/FI - 1997 Form Interpreter
  • Rasmus wrote a much larger C implementation,
    which was able to communicate with databases, and
    enabled users to develop simple dynamic Web
    applications .
  • Personal Home Page / Forms Interpreter
  • PHP 3.0 June 1998
  • lots of different databases, protocols and APIs,
  • Developers joined in and submit new extension
    modules
  • PHP Hypertext Preprocessor.

6
ProgrammerBlog.Net

http//programmerblog.net/
PHP History
  • PHP 4
  • Zend Engine Introduced in 1999
  • Support for Web servers
  • Object Oriented Programming
  • PHP 5
  • Zend Engine 2.0
  • XML and Web Services
  • Object Oriented Support
  • Exception Handling
  • A lot of new Features

7
PHP History
ProgrammerBlog.Net

http//programmerblog.net/
  • PHP 7 current version on PHP
  • is latest version of PHP with lot of improvement.
    Some of new features are
  • 1. Speed
  • 2. Type Declaration
  • 3. Return Type Declarations
  • 4. Error Handling
  • 5. Spaceship Operator
  • 6. Null Coalesce Operator
  • 7. Unicode support for emoji and international
    characters.
  • 8. Constant arrays using define()
  • 9. Anonymous classes
  • 10.Generator delegation
  • 11.CSPRNG Functions Generate cryptographically
    secure integers and strings in cross platform
  • way

8
ProgrammerBlog.Net

http//programmerblog.net/
Why PHP ?
  • Open Source Linux Apache - PHP - MySQL
  • One of top 5 most popular languages
  • Small medium enterprise level applications
  • Server Side Scripting
  • Command Line
  • Desktop Applications (PHP GTK)
  • Available for Windows, Linux, Mac
  • Many Web Servers Apache, IIS, nginx,
    Lighthttpd
  • Relational / No SQL Databases MySql, Oracle,
    MSSQL, mongoDB, PostgreSql
  • Built in Support Regex, XML and other functions
    math etc
  • Services LDAP, POP3 and so on

9
ProgrammerBlog.Net

http//programmerblog.net/
PHP Online Popular Projects
  • PHP
  • Facebook - The worlds biggest social networking
    platform is written in PHP.
  • 150 million users and counting, and in my
    experience, significantly faster and more stable
    than competing platforms written in other
    languages (e.g. MySpace).
  • Yahoo! - formerly the worlds largest search
    engine. Yahoo! makes use of PHP.
  • You Tube - the worlds biggest video sharing
    website uses PHP technology.
  • Wikipedia - User contributed web encyclopedia has
    PHP elements.
  • Digg.comSocial news network.
  • Sourceforge.orgThe world's largest Open Source
    software development web site.
  • Flickr.comOnline photo sharing and storing

10
ProgrammerBlog.Net

http//programmerblog.net/
PHP Configuration
  • PHP.ini
  • Php configuration file is read when php
    starts up. Values of different environment
    variables can be set in php.ini file. Some of the
    features are
  • Execution time
  • File upload size and so on
  • Session paths
  • Upload file size
  • Short tags
  • Error reporting
  • Safe mode

11
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Code Blocks
  • Standard Tags lt?php ?gt
  • Short Tags lt?........ ?gt
  • ASP Tags lt.....gt (Removed from php 7.0)
  • Script Tags
  • ltscript languagePHPgtlt/scriptgt (Removed from
  • PHP 7.0)

12
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Language Constructs
  • Constructs are elements that are built-into the
    language
  • echo
  • echo 10
  • Every statement ends with semi colon.

13
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Comments
  • Single Line Comments -
  • // this is a single line comment
  • this is a single line comment
  • Multi Line Comments - / .. /
  • / This is a
  • Multi line comment
  • /

14
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Data Types
  • Scalar Data types
  • Integer (Signed)
  • String
  • Floating point
  • Boolean
  • Composite
  • Arrays
  • Objects

15
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Data Types
  • Integer
  • echo 10 echo -123echo 066 echo 0xFF
  • Floating Point
  • echo 10.2 echo 0.009
  • echo 2E7 echo 1e2

16
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Data Types
  • String
  • echo String in double quotesecho string in
    single quotes
  • Boolean
  • True or False
  • Composite Data types
  • Arrays , Objects
  • Null
  • Resource

17
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Variables
  • PHP is a loosely typed language
  • Variables are storage container in memory
  • Variables are identified with sign
  • Valid variables
  • a-zA-Z, numbers, underscores
  • Variable variable
  • contents of variable to reference a new variable

18
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Variables
  • Variables existence
  • Isset
  • Destroying
  • unset
  • Constants
  • define(country",     United States")

19
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Operators
  • operators are the catalysts of operations
  • Assignment Operators
  • Arithmetic Operators - /
  • String Operators .
  • Comparison Operators lt gt lt gt Ternary
    operator
  • Logical Operators ! XOR
  • Bitwise Operators XOR NOT
  • Error Control Operators
  • Incrementing/Decrementing Operators --
  • Typeof

20
ProgrammerBlog.Net

http//programmerblog.net/
Operators Increment / Decrement
  • a 1
  • // Assign the integer 1 to a
  • echo a
  • // Outputs 1, a is now equal to 2
  • echo a
  • // Outputs 3, a is now equal to 3
  • echo --a
  • // Outputs 2, a is now equal to 2
  • echo a--
  • // Outputs 2, a is now equal to 1

21
ProgrammerBlog.Net

http//programmerblog.net/
Operators Arithmetic Operators
  • Addition a 1 3.5
  • Subtraction a 4 - 2
  • Multiplication a 8 3
  • Division a 15 / 5
  • Modulus a 23 7

22
ProgrammerBlog.Net

http//programmerblog.net/
Concatenation - Assignment Operator
  • string PHP" . MySql"
  • string2 Zend"
  • string . string2
  • echo string
  • Will print PHP MySql Zend

23
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Operator Precedence
  • x 9 1 10
  • Expecting result 100 but getting 19
    Multiplication has higher precedence
  • Highest Precedence /
  • -
    .
  • lt lt
    gt gt
  • And
  • Xor
  • Lowest precedence or

24
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Escape Sequences
  • \" Print the next character as a double quote,
    not a string closer
  • \' Print the next character as a single quote,
    not a string closer
  • \n Print a new line character (remember our
    print statements?)
  • \t Print a tab character
  • \r Print a carriage return (not used very
    often)
  • \ Print the next character as a dollar, not as
    part of a variable
  • \\ Print the next character as a backslash,
    not an escape character
  •   MyString "This is an
    \"escaped\" string"    MySingleString
    'This \'will\' work'    MyNonVariable "I
    have \marks in my pocket"    MyNewline
    "This ends with a line return\n"    MyFile
    "c\\windows\\system32\\myfile
    .txt"

25
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Control Structure -1
  • Control structures allow you to control the flow
    of your script
  • if (expression1)
  • elseif (expression2)
  • else

26
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Control Structure -1
  • ternary operator
  • (condition) ? output output
  • echo 10 x ? Yes No
  • Equivalent in IF-Else
  • if (10 x)
  • echo 'Yes'
  • else
  • echo 'No'

27
ProgrammerBlog.Net

http//programmerblog.net/
Control Structures Switch statement
  • switch (n) case label1   //code to be
    executed if nlabel1   break
  • case label2   //code to be executed if
    nlabel2   break
  • default //  if n is different from both
    label1 and label2

28
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics 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

29
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics While Loop
  • while (condition)   code to be executed 
  • i1while(ilt5)    echo "The number is " .
    i . "ltbr /gt"  i  

30
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics Do While Loop
  • do    code to be executed  while
    (condition)
  • i1do     i   echo "The number is " .
    i . "ltbr /gt"  while (ilt5)

31
ProgrammerBlog.Net

http//programmerblog.net/
PHP Basics For Loop
  • for (init condition increment)    code to be
    executed 
  • for (i1 ilt5 i)    echo "The number is
    " . i . "ltbr /gt" 
  • Break
  • Causes the loop to stop and program execution to
    begin at the statement immediately following the
    loop.
  • Continue
  • causes the iteration to be skipped

32
ProgrammerBlog.Net

http//programmerblog.net/
Thanks for reading
For more articles and video tutorials
please visit our Blog http//Programmer
Blog
Write a Comment
User Comments (0)
About PowerShow.com