SlideShare a Scribd company logo
1 of 26
Web Server ,[object Object],[object Object],[object Object]
Operation Principles
What is PHP? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What is a PHP File? -PHP files can contain text, HTML tags and scripts. -PHP files are returned to the browser as plain HTML. -PHP files have a file extension of ".php", ".php3", or ".phtml“.
What is MySQL? -MySQL is a database server. -MySQL is ideal for both small and large applications. -MySQL supports standard SQL. -MySQL compiles on a number of platforms. -MySQL is free to download and use.
LAMP ,[object Object],[object Object],[object Object],[object Object]
PHP Syntax ,[object Object],[object Object],[object Object]
PHP Variables ,[object Object],[object Object],[object Object]
PHP String Variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
PHP Operators -Arithmetic Operators -Assignment Operators - Comparison Operators   -Logical Operators
PHP Operators (Arithmetic)
PHP Operators (Assignment   )
PHP Operators (Comparison)
PHP Operators (Logical)
PHP If...Else Statements ,[object Object],[object Object]
PHP Switch Statement ,[object Object]
PHP Switch Statement(Cont) <?php switch ($x) { case 1:   echo &quot;Number 1&quot;;   break; case 2:   echo &quot;Number 2&quot;;   break; case 3:   echo &quot;Number 3&quot;;   break; default:   echo &quot;No number between 1 and 3&quot;; } ?>
PHP Arrays Numeric array  - An array with a numeric index. * $cars=array(&quot;Saab&quot;,&quot;Volvo&quot;,&quot;BMW&quot;,&quot;Toyota&quot;);  Associative array  - An array where each ID key is associated with a value * $ages = array(&quot;Peter&quot;=>32, &quot;Quagmire&quot;=>30, &quot;Joe&quot;=>34);  Multidimensional array  - An array containing one or more arrays. * $families = array (&quot;Griffin&quot;=>array (&quot;Peter&quot;,&quot;Lois&quot;,&quot;Megan&quot;),  &quot;Quagmire&quot;=>array(&quot;Glenn&quot;) );
PHP Looping - While Loops while ( condition ) {   code to be executed ; }  <?php $i=1; while($i<=5) {   echo &quot;The number is &quot; . $i . &quot;<br />&quot;; $i++; } ?>   do   {   code to be executed;    } while ( condition ); <?php $i=1; do   {   $i++;   echo &quot;The number is &quot; . $i . &quot;<br />&quot;;   } while ($i<=5); ?>
PHP Looping - For Loops for ( init; condition; increment ) {    code to be executed; }  <?php for ($i=1; $i<=5; $i++) {   echo &quot;The number is &quot; . $i . &quot;<br />&quot;; } ?> foreach ($ array  as   $ value )  {    code to be executed;  } <?php $x=array(&quot;one&quot;,&quot;two&quot;,&quot;three&quot;); foreach ($x as $value) {   echo $value . &quot;<br />&quot;; } ?>
PHP Functions function  functionName () {   code to be executed ; } <?php function writeName() { echo &quot;Kai Jim Refsnes&quot;; } echo &quot;My name is &quot;; writeName(); ?>  <html> <body> <?php function &add($x,$y) {   $total=$x+$y;   return $total; } echo &quot;1 + 16 = &quot; . add(1,16); ?> </body> </html>
PHP Forms and User Input <html> <body> <form action=&quot;welcome.php&quot; method=&quot;post&quot;> Name: <input type=&quot;text&quot; name=&quot;fname&quot; /> Age: <input type=&quot;text&quot; name=&quot;age&quot; /> <input type=&quot;submit&quot; /> </form> </body> </html>  <html> <body> Welcome <?php echo $_POST[&quot;fname&quot;]; ?>!<br /> You are <?php echo $_POST[&quot;age&quot;]; ?> years old. </body> </html>
PHP $_GET Function <html> <body> <form action=&quot;welcome.php&quot; method=“get&quot;> Name: <input type=&quot;text&quot; name=&quot;fname&quot; /> Age: <input type=&quot;text&quot; name=&quot;age&quot; /> <input type=&quot;submit&quot; /> </form> </body> </html>  <html> <body> Welcome <?php echo $_GET[&quot;fname&quot;]; ?>!<br /> You are <?php echo $_GET[&quot;age&quot;]; ?> years old. </body> </html>  http://www.dqn.vn/welcome.php?fname=Peter&age=37
PHP $_POST Function <html> <body> <form action=&quot;welcome.php&quot; method=“post&quot;> Name: <input type=&quot;text&quot; name=&quot;fname&quot; /> Age: <input type=&quot;text&quot; name=&quot;age&quot; /> <input type=&quot;submit&quot; /> </form> </body> </html>  <html> <body> Welcome <?php echo $_POST[&quot;fname&quot;]; ?>!<br /> You are <?php echo $_POST[&quot;age&quot;]; ?> years old. </body> </html>  http://www.dqn.vn/welcome.php.
The PHP $_REQUEST Function ,[object Object],[object Object]
PHP With Database mysql_connect (&quot;localhost&quot;, &quot;mysql_user&quot;, &quot;mysql_password&quot;) or     die(&quot;Could not connect: &quot; . mysql_error()); mysql_select_db (&quot;mydb&quot;); $result =  mysql_query (&quot;SELECT id, name FROM mytable&quot;); while ($row =  mysql_fetch_array ($result)) {     printf(&quot;ID: %s  Name: %s&quot;, $row[0], $row[1]);   } mysql_free_result ($result);  mysql_close() ;

More Related Content

What's hot (20)

PHP - Introduction to PHP
PHP -  Introduction to PHPPHP -  Introduction to PHP
PHP - Introduction to PHP
 
Php Tutorial
Php TutorialPhp Tutorial
Php Tutorial
 
PHP POWERPOINT SLIDES
PHP POWERPOINT SLIDESPHP POWERPOINT SLIDES
PHP POWERPOINT SLIDES
 
02 Php Vars Op Control Etc
02 Php Vars Op Control Etc02 Php Vars Op Control Etc
02 Php Vars Op Control Etc
 
Php.ppt
Php.pptPhp.ppt
Php.ppt
 
Php(report)
Php(report)Php(report)
Php(report)
 
Php basics
Php basicsPhp basics
Php basics
 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
 
Introduction To Php For Wit2009
Introduction To Php For Wit2009Introduction To Php For Wit2009
Introduction To Php For Wit2009
 
PHP
PHPPHP
PHP
 
Chapter 02 php basic syntax
Chapter 02   php basic syntaxChapter 02   php basic syntax
Chapter 02 php basic syntax
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
basic concept of php(Gunikhan sonowal)
basic concept of php(Gunikhan sonowal)basic concept of php(Gunikhan sonowal)
basic concept of php(Gunikhan sonowal)
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
Intro to php
Intro to phpIntro to php
Intro to php
 
PHP
PHPPHP
PHP
 
Php
PhpPhp
Php
 
01 Php Introduction
01 Php Introduction01 Php Introduction
01 Php Introduction
 
PHP tutorial | ptutorial
PHP tutorial | ptutorialPHP tutorial | ptutorial
PHP tutorial | ptutorial
 
Download It
Download ItDownload It
Download It
 

Viewers also liked

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
 
Rizal and other heroes heroines chapter 10 rizal's first home coming 1887-88
Rizal and other heroes heroines chapter 10 rizal's first home coming 1887-88Rizal and other heroes heroines chapter 10 rizal's first home coming 1887-88
Rizal and other heroes heroines chapter 10 rizal's first home coming 1887-88Mary Grace Mancao
 
Oral versus written assessments
Oral versus written assessmentsOral versus written assessments
Oral versus written assessmentsChris Willmott
 
Banghay Aralin sa pagtuturo ng filipino
Banghay Aralin sa pagtuturo ng filipinoBanghay Aralin sa pagtuturo ng filipino
Banghay Aralin sa pagtuturo ng filipinoMardie de Leon
 
Research Paper on Academic Cheating
Research Paper on Academic CheatingResearch Paper on Academic Cheating
Research Paper on Academic CheatingGrace Andoyo
 

Viewers also liked (20)

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
 
PHP MySQL Workshop - facehook
PHP MySQL Workshop - facehookPHP MySQL Workshop - facehook
PHP MySQL Workshop - facehook
 
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
 
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
 
Rizal and other heroes heroines chapter 10 rizal's first home coming 1887-88
Rizal and other heroes heroines chapter 10 rizal's first home coming 1887-88Rizal and other heroes heroines chapter 10 rizal's first home coming 1887-88
Rizal and other heroes heroines chapter 10 rizal's first home coming 1887-88
 
Non – projected
Non – projectedNon – projected
Non – projected
 
Oral versus written assessments
Oral versus written assessmentsOral versus written assessments
Oral versus written assessments
 
Banghay Aralin sa pagtuturo ng filipino
Banghay Aralin sa pagtuturo ng filipinoBanghay Aralin sa pagtuturo ng filipino
Banghay Aralin sa pagtuturo ng filipino
 
suplay
suplaysuplay
suplay
 
Asean Integration 2015
Asean Integration 2015 Asean Integration 2015
Asean Integration 2015
 
Poems of Rizal
Poems of RizalPoems of Rizal
Poems of Rizal
 
My Porfolio
My PorfolioMy Porfolio
My Porfolio
 
Travels of rizal (1)
Travels of rizal (1)Travels of rizal (1)
Travels of rizal (1)
 
Research Paper on Academic Cheating
Research Paper on Academic CheatingResearch Paper on Academic Cheating
Research Paper on Academic Cheating
 

Similar to Php Training (20)

What Is Php
What Is PhpWhat Is Php
What Is Php
 
Web development
Web developmentWeb development
Web development
 
Control Structures In Php 2
Control Structures In Php 2Control Structures In Php 2
Control Structures In Php 2
 
Introduction To Lamp
Introduction To LampIntroduction To Lamp
Introduction To Lamp
 
Php 3 1
Php 3 1Php 3 1
Php 3 1
 
Php Crash Course
Php Crash CoursePhp Crash Course
Php Crash Course
 
John Rowley Notes
John Rowley NotesJohn Rowley Notes
John Rowley Notes
 
PHP Tutorials
PHP TutorialsPHP Tutorials
PHP Tutorials
 
PHP Tutorials
PHP TutorialsPHP Tutorials
PHP Tutorials
 
Open Source Package PHP & MySQL
Open Source Package PHP & MySQLOpen Source Package PHP & MySQL
Open Source Package PHP & MySQL
 
Open Source Package Php Mysql 1228203701094763 9
Open Source Package Php Mysql 1228203701094763 9Open Source Package Php Mysql 1228203701094763 9
Open Source Package Php Mysql 1228203701094763 9
 
The Basics Of Page Creation
The Basics Of Page CreationThe Basics Of Page Creation
The Basics Of Page Creation
 
Php
PhpPhp
Php
 
PHP MySQL
PHP MySQLPHP MySQL
PHP MySQL
 
Php intro
Php introPhp intro
Php intro
 
PHP Presentation
PHP PresentationPHP Presentation
PHP Presentation
 
PHP Presentation
PHP PresentationPHP Presentation
PHP Presentation
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 
Justmeans power point
Justmeans power pointJustmeans power point
Justmeans power point
 

Php Training

  • 1.
  • 3.
  • 4. What is a PHP File? -PHP files can contain text, HTML tags and scripts. -PHP files are returned to the browser as plain HTML. -PHP files have a file extension of &quot;.php&quot;, &quot;.php3&quot;, or &quot;.phtml“.
  • 5. What is MySQL? -MySQL is a database server. -MySQL is ideal for both small and large applications. -MySQL supports standard SQL. -MySQL compiles on a number of platforms. -MySQL is free to download and use.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10. PHP Operators -Arithmetic Operators -Assignment Operators - Comparison Operators -Logical Operators
  • 15.
  • 16.
  • 17. PHP Switch Statement(Cont) <?php switch ($x) { case 1:   echo &quot;Number 1&quot;;   break; case 2:   echo &quot;Number 2&quot;;   break; case 3:   echo &quot;Number 3&quot;;   break; default:   echo &quot;No number between 1 and 3&quot;; } ?>
  • 18. PHP Arrays Numeric array - An array with a numeric index. * $cars=array(&quot;Saab&quot;,&quot;Volvo&quot;,&quot;BMW&quot;,&quot;Toyota&quot;); Associative array - An array where each ID key is associated with a value * $ages = array(&quot;Peter&quot;=>32, &quot;Quagmire&quot;=>30, &quot;Joe&quot;=>34); Multidimensional array - An array containing one or more arrays. * $families = array (&quot;Griffin&quot;=>array (&quot;Peter&quot;,&quot;Lois&quot;,&quot;Megan&quot;),  &quot;Quagmire&quot;=>array(&quot;Glenn&quot;) );
  • 19. PHP Looping - While Loops while ( condition ) { code to be executed ; } <?php $i=1; while($i<=5) {   echo &quot;The number is &quot; . $i . &quot;<br />&quot;; $i++; } ?> do   {   code to be executed;   } while ( condition ); <?php $i=1; do   {   $i++;   echo &quot;The number is &quot; . $i . &quot;<br />&quot;;   } while ($i<=5); ?>
  • 20. PHP Looping - For Loops for ( init; condition; increment ) {    code to be executed; } <?php for ($i=1; $i<=5; $i++) {   echo &quot;The number is &quot; . $i . &quot;<br />&quot;; } ?> foreach ($ array as $ value ) {    code to be executed;  } <?php $x=array(&quot;one&quot;,&quot;two&quot;,&quot;three&quot;); foreach ($x as $value) {   echo $value . &quot;<br />&quot;; } ?>
  • 21. PHP Functions function functionName () { code to be executed ; } <?php function writeName() { echo &quot;Kai Jim Refsnes&quot;; } echo &quot;My name is &quot;; writeName(); ?> <html> <body> <?php function &add($x,$y) { $total=$x+$y; return $total; } echo &quot;1 + 16 = &quot; . add(1,16); ?> </body> </html>
  • 22. PHP Forms and User Input <html> <body> <form action=&quot;welcome.php&quot; method=&quot;post&quot;> Name: <input type=&quot;text&quot; name=&quot;fname&quot; /> Age: <input type=&quot;text&quot; name=&quot;age&quot; /> <input type=&quot;submit&quot; /> </form> </body> </html> <html> <body> Welcome <?php echo $_POST[&quot;fname&quot;]; ?>!<br /> You are <?php echo $_POST[&quot;age&quot;]; ?> years old. </body> </html>
  • 23. PHP $_GET Function <html> <body> <form action=&quot;welcome.php&quot; method=“get&quot;> Name: <input type=&quot;text&quot; name=&quot;fname&quot; /> Age: <input type=&quot;text&quot; name=&quot;age&quot; /> <input type=&quot;submit&quot; /> </form> </body> </html> <html> <body> Welcome <?php echo $_GET[&quot;fname&quot;]; ?>!<br /> You are <?php echo $_GET[&quot;age&quot;]; ?> years old. </body> </html> http://www.dqn.vn/welcome.php?fname=Peter&age=37
  • 24. PHP $_POST Function <html> <body> <form action=&quot;welcome.php&quot; method=“post&quot;> Name: <input type=&quot;text&quot; name=&quot;fname&quot; /> Age: <input type=&quot;text&quot; name=&quot;age&quot; /> <input type=&quot;submit&quot; /> </form> </body> </html> <html> <body> Welcome <?php echo $_POST[&quot;fname&quot;]; ?>!<br /> You are <?php echo $_POST[&quot;age&quot;]; ?> years old. </body> </html> http://www.dqn.vn/welcome.php.
  • 25.
  • 26. PHP With Database mysql_connect (&quot;localhost&quot;, &quot;mysql_user&quot;, &quot;mysql_password&quot;) or     die(&quot;Could not connect: &quot; . mysql_error()); mysql_select_db (&quot;mydb&quot;); $result =  mysql_query (&quot;SELECT id, name FROM mytable&quot;); while ($row =  mysql_fetch_array ($result)) {     printf(&quot;ID: %s  Name: %s&quot;, $row[0], $row[1]);   } mysql_free_result ($result); mysql_close() ;