21
PhP-MySQL Pagora 2012/2013 CTD 2

PhP -MySQL

  • Upload
    abril

  • View
    111

  • Download
    3

Embed Size (px)

DESCRIPTION

PhP -MySQL. Pagora 2012/2013 CTD 2. Première balise. Plusieurs types de balise … Partout !. Hello World. mknk. Simple vs Double quotes. Exercice : Analyse du code. Variables. Variables. Entiers $decimal = 10; - PowerPoint PPT Presentation

Citation preview

Page 1: PhP -MySQL

PhP-MySQLPagora 2012/2013

CTD 2

Page 2: PhP -MySQL

Première balise

- Plusieurs typesde balise

- <?php … ?>- <? … ?>- <script language=‘php’> … </script>

- Partout !

Page 3: PhP -MySQL

Hello World

mknk

Page 4: PhP -MySQL

Simple vs Double quotes

Exercice:Analyse du code

Page 5: PhP -MySQL

Variables

Page 6: PhP -MySQL

Variables

Entiers $decimal = 10; $hexa = 0x0F; $octal = 020;

Decimaux $normal = 0.017; $scientifique = 17.0E-3;

séquences d'échappement \n: Nouvelle ligne \t: Tabulation \r: Retour chariot \\: Anti slash \$: Signe dollar

Page 7: PhP -MySQL

Variables dynamiquesElles autorisent en fait à créer une variable dont le nom est contenu dans une autre variable.

Autre syntaxe: ${$first}Permet de désambiguïser lors de manipulation de tableaux:

$$tab[1] ?${$tab[1]} tab [1] contient une variable${$tab}[1] $tab contient le nom d’une variable (tableau en l’occurrence)

Page 8: PhP -MySQL

Opérations

Page 9: PhP -MySQL

VariablesTableaux:

Page 10: PhP -MySQL

Structure de contrôle: ifIF, ELSEIF, ELSE:

Page 11: PhP -MySQL

Structure de contrôle: switch

Page 12: PhP -MySQL

Structure de contrôle: while

Page 13: PhP -MySQL

Structure de contrôle: forBoucleFor:

BreakContinue:

Page 14: PhP -MySQL

Structure de contrôle: foreach

Page 15: PhP -MySQL

PhP-MySQLStructuration du code:

Modularité, inclusion et contrôle

Page 16: PhP -MySQL

Structuration du codeheader.php

footer.php

vars.php

Page 17: PhP -MySQL

Structuration du codeindex.php

Page 18: PhP -MySQL

Structuration du code

Page 19: PhP -MySQL

Structuration du code

http://lmgtfy.com/?q=list+files+php

Exemple de menu dynamique:

Page 21: PhP -MySQL

Retour aux formulaires: GET, POST

Osef.php

Ex_form.html

Exemple en live…