PHPMySQL_CH01

download PHPMySQL_CH01

of 25

Transcript of PHPMySQL_CH01

  • 7/25/2019 PHPMySQL_CH01

    1/25

    LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    PHP and MySQL for

    Dynamic Web Sites 4th Edition

    Instructors NotesChapter 1: Introduction to PHP

    Copyright 2012 by Larry Ullan

  • 7/25/2019 PHPMySQL_CH01

    2/25

    LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Leanin O"t#o$e%

    ! Create a basic PHP script

    ! "#ecute a PHP script

    ! $end data to the %eb bro&ser! %rite coents in PHP

    ! 'eonstrate ho& to use (ariables

    ! %or) &ith string (ariables* including concatenation and

    a +e& string +unctions

  • 7/25/2019 PHPMySQL_CH01

    3/25

    LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Leanin O"t#o$e%

    ! %or) &ith nueric (ariables* including arithetic and+oratting

    ! %or) &ith constants

    ! ,no& ho& PHP treats the t&o -uotation ar) typesdi++erently

    ! .ecogni/e coon escape se-uences

    ! Ipleent soe basic debugging techni-ues

  • 7/25/2019 PHPMySQL_CH01

    4/25

    LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    &a%i# PHP S#i't

  • 7/25/2019 PHPMySQL_CH01

    5/25

    LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    R"nnin a PHP S#i't

    ! ust ha(e a PHPenabled %eb ser(er e3g3* 4pache5

    ! Place the PHP script in the %eb directory

    ! 4ccess the +ile in your bro&ser through a U.Lhttp65

  • 7/25/2019 PHPMySQL_CH01

    6/25

    LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Sendin Data to the

    &o(%e4h# 9Hll#: '#rl+!95

    4h# "What9 ';"5

    %rt 9Hll#: '#rl+!95

    %rt "What9 ';"5

  • 7/25/2019 PHPMySQL_CH01

    7/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Sendin Data to the

    &o(%e

  • 7/25/2019 PHPMySQL_CH01

    8/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Sendin HT)Lto the

    &o(%e

  • 7/25/2019 PHPMySQL_CH01

    9/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    E%#a'in Chaa#te%

    4h# "h a+: "H#' ar #;""5 // Err#r!

    4h# 9I9m =t +4>.95 // Err#r!

    4h# 9h a+: "H#' ar #;"954h# "I9m =t +4>."5

    4h# "h a+: ?"H#' ar #;?""5

    %rt 9I?9m =t +4>.95

  • 7/25/2019 PHPMySQL_CH01

    10/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Pa%e Eo%

  • 7/25/2019 PHPMySQL_CH01

    11/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Witin Co$$ent%

  • 7/25/2019 PHPMySQL_CH01

    12/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Vaia*+e T,'e%

    ! 7oolean

    ! Integer

    ! 8loating point! $tring

    ! 4rray

    ! 9bects

    ! .esources! Null

  • 7/25/2019 PHPMySQL_CH01

    13/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Vaia*+e Na$e%

    ! $tart &ith a ;

    ! Contain only letters* nubers* and the underscore

    !

  • 7/25/2019 PHPMySQL_CH01

    14/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Pintin Vaia*+e%

    %rt #m2ar5

    %rt "Hll#: am"5

    %rt 9Hll#: am95 // W#9t '#r>!

  • 7/25/2019 PHPMySQL_CH01

    15/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Stin Va+"e%

    ! >

    ! ?In &aterelon sugar?

    ! >100>! >4ugust 2* 2011>

  • 7/25/2019 PHPMySQL_CH01

    16/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Ceatin and U%in Stin%

    6rtam 9T#8a95

    t#+a 9A(t : 01195

    2ar "D6 ?"%latt+?": %la."5

    2ar 9D6 "%latt+": %la.95

    4h# 6rtam5

    4h# "Hll#: 6rtam"5

  • 7/25/2019 PHPMySQL_CH01

    17/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Pe-o$in Con#atenation

    4t 9attl95

    tat 9Wah(t#95

    a++r 4t . 9: 9 . tat5

    // Or&

    4t 9attl95

    tat 9Wah(t#95

    a++r 4t5

    a++r . 9: 95

    a++r . tat5

  • 7/25/2019 PHPMySQL_CH01

    18/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    N"$ei# Va+"e%

    ! @

    ! A31B

    ! 10@2ABD! B32D0B@

    ! B3Be2

    VISUAL QUICKPRO GUIDE

  • 7/25/2019 PHPMySQL_CH01

    19/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Ceatin and U%in

    N"$*e% 3.1F5

    r#+ G5 // 3

    3.1F7J5 r#+ G: 35 // 3.1F3

    0F35

    m8r6#rmat G5 // 0:F3

    0F35 m8r6#rmat G: 5 // 0:F3.00

    VISUAL QUICKPRO GUIDE

  • 7/25/2019 PHPMySQL_CH01

    20/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Aith$eti# O'eato%

    Operator Meaning

    E 4ddition

    $ubtraction

    F ultiplication

    G 'i(ision

    odulus

    EE Increent

    'ecreent

    VISUAL QUICKPRO GUIDE

  • 7/25/2019 PHPMySQL_CH01

    21/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Pe-o$in Aith$eti#

  • 7/25/2019 PHPMySQL_CH01

    22/25LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Ceatin and U%in

    Con%tant%+6 G9$AME9: 2al5

    +6 G9UE)$AME9: 9tr#t#4t95

    +6 G9PI9: 3.1F5

    4h# "Hll#: UE)$AME"5 // W#9t '#r>!

    4h# 9Hll#: 9 . UE)$AME5

    VISUAL QUICKPRO GUIDE

  • 7/25/2019 PHPMySQL_CH01

    23/25

    LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    Q"otation )a.%

    2ar 9tt95

    4h# "2ar al t# 2ar"5

    4h# 92ar al t# 2ar95

    4h# "?2ar al t# 2ar"54h# 9?2ar al t# 2ar9

    VISUAL QUICKPRO GUIDE

  • 7/25/2019 PHPMySQL_CH01

    24/25

    LEARN THE QUICK AND EASY WAY!

    VISUAL QUICKPROGUIDE

    E%#a'e Se/"en#e%

    Code Meaning

    ? 'ouble -uotation ar)

    > $ingle -uotation ar)

    7ac)slash

    n Ne&line

    r Carriage return

    t

  • 7/25/2019 PHPMySQL_CH01

    25/25

    VISUAL QUICKPROGUIDE

    &a%i# De*"in

    ! 4l&ays run PHP scripts through a U.L

    ! ,no& the (ersion o+ PHP youre using

    ! "nable displayJerrors! Chec) the H