Presentation is loading. Please wait.

Presentation is loading. Please wait.

PHP using MySQL Database for Web Development (part II)

Similar presentations


Presentation on theme: "PHP using MySQL Database for Web Development (part II)"— Presentation transcript:

1 PHP using MySQL Database for Web Development (part II)
Pongtawan Saengsawang Managing Director, Open Source Solution & Technology Co., Ltd.

2 Basic Web Base Programming II
How Web App Works Basic Web Base Programming II

3 Basic Web Base Programming II
PHP Basic Web Base Programming II What is PHP? PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use What is a PHP File? PHP files can contain text, HTML, CSS, JavaScript, and PHP code PHP code are executed on the server, and the result is returned to the browser as plain HTML PHP files have extension ".php”

4 Basic Web Base Programming II
PHP Basic Web Base Programming II What Can PHP Do? PHP can generate dynamic page content PHP can create, open, read, write, delete, and close files on the server PHP can collect form data PHP can send and receive cookies PHP can add, delete, modify data in your database PHP can be used to control user-access PHP can encrypt data Why PHP? PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.) PHP is compatible with almost all servers used today (Apache, IIS, etc.) PHP supports a wide range of databases PHP is free. Download it from the official PHP resource:  PHP is easy to learn and runs efficiently on the server side

5 Basic Web Base Programming II
Basic PHP Syntax Basic Web Base Programming II A PHP script can be placed anywhere in the document. A PHP script starts with <?php and ends with ?>: The default file extension for PHP files is ".php". A PHP file normally contains HTML tags, and some PHP scripting code.

6 Basic Web Base Programming II
Basic PHP Syntax Basic Web Base Programming II

7 Basic Web Base Programming II
PHP echo and print Statements Basic Web Base Programming II

8 Basic Web Base Programming II
Creating (Declaring) PHP Variables Basic Web Base Programming II A variable starts with the $ sign, followed by the name of the variable A variable name must start with a letter or the underscore character A variable name cannot start with a number A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ) Variable names are case-sensitive ($age and $AGE are two different variables)

9 Basic Web Base Programming II
Output Variables Basic Web Base Programming II

10 Basic Web Base Programming II
PHP Data Types Basic Web Base Programming II PHP supports the following data types: String Integer Float (floating point numbers - also called double) Boolean Array Object NULL Resource (Database Call)

11 Basic Web Base Programming II
PHP Operators Basic Web Base Programming II Operators are used to perform operations on variables and values. PHP divides the operators in the following groups: Arithmetic operators Assignment operators Comparison operators Increment/Decrement operators Logical operators String operators Array operators

12 Basic Web Base Programming II
PHP Arithmetic Operators Basic Web Base Programming II

13 Basic Web Base Programming II
PHP Assignment Operators Basic Web Base Programming II

14 Basic Web Base Programming II
PHP Comparison Operators Basic Web Base Programming II

15 Basic Web Base Programming II
PHP Increment / Decrement Operators Basic Web Base Programming II

16 Basic Web Base Programming II
PHP Logical Operators Basic Web Base Programming II

17 Basic Web Base Programming II
PHP String Operators Basic Web Base Programming II

18 Basic Web Base Programming II
PHP Array Operators Basic Web Base Programming II

19 Basic Web Base Programming II
PHP Conditional Statements Basic Web Base Programming II In PHP we have the following conditional statements: if statement - executes some code if one condition is true if...else statement - executes some code if a condition is true and another code if that condition is false if...elseif....else statement - executes different codes for more than two conditions switch statement - selects one of many blocks of code to be executed

20 Basic Web Base Programming II
The if Statement Basic Web Base Programming II

21 Basic Web Base Programming II
The if...else Statement Basic Web Base Programming II

22 Basic Web Base Programming II
The if...elseif....else Statement Basic Web Base Programming II

23 Basic Web Base Programming II
The PHP switch Statement Basic Web Base Programming II

24 Basic Web Base Programming II
The PHP switch Statement Basic Web Base Programming II

25 Basic Web Base Programming II
PHP Loops Basic Web Base Programming II In PHP, we have the following looping statements: while - loops through a block of code as long as the specified condition is true do...while - loops through a block of code once, and then repeats the loop as long as the 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

26 Basic Web Base Programming II
The PHP while Loop Basic Web Base Programming II

27 Basic Web Base Programming II
The PHP do...while Loop Basic Web Base Programming II

28 Basic Web Base Programming II
The PHP for Loop Basic Web Base Programming II

29 Basic Web Base Programming II
The PHP foreach Loop Basic Web Base Programming II

30 Basic Web Base Programming II
Create a User Defined Function in PHP Basic Web Base Programming II

31 Basic Web Base Programming II
Workshop Time


Download ppt "PHP using MySQL Database for Web Development (part II)"

Similar presentations


Ads by Google