Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction To PHP 20 * Introducing the basics of programming * Discovering variables, loops, arrays and conditions * Integrating HTML and PHP Stations.

Similar presentations


Presentation on theme: "Introduction To PHP 20 * Introducing the basics of programming * Discovering variables, loops, arrays and conditions * Integrating HTML and PHP Stations."— Presentation transcript:

1 Introduction To PHP 20 * Introducing the basics of programming * Discovering variables, loops, arrays and conditions * Integrating HTML and PHP Stations Along the Way © Wiley Publishing. 2006. All Rights Reserved.

2 Basics of PHP Programming © Wiley Publishing. 2006. All Rights Reserved.  Traditional, top-down, global variable  Accurate error feedback  Contains enterprise-level attributes of Java  Low overhead  Easy to use  True cross-platform capability  Allows interaction with the file system

3 Creating PHP Output © Wiley Publishing. 2006. All Rights Reserved.  Output can be an action, a message, both, or an error.  Usually output is an action that sends a message to the screen or a Web browser.  Output is generated with the echo function in PHP.

4 Variables © Wiley Publishing. 2006. All Rights Reserved.  Variables are information placeholders that have no specific values of their own.  Variables take on values assigned to them by an external method.  Use logical, descriptive names for variables.  A starting value for a variable can be given.  Once a value is assigned to a variable, the value can be referenced with the variable name.  Variables can be stacked (one variable follows another) in a PHP program.

5 Scalar and Array Variables © Wiley Publishing. 2006. All Rights Reserved.  Scalar Variables are simple variables that have one value.  Array Variables hold multiple values.

6 PHP Program Loop  Programming technique that iterates through a list of values one at a time, until complete.  Program looping is done very rapidly.  During a loop, the program can act on members of the list, write a message to the screen, write a file, echo data to the screen and more. © Wiley Publishing. 2006. All Rights Reserved.

7 Array Variables and Conditions © Wiley Publishing. 2006. All Rights Reserved.  Arrays  Database data is appropriate for associative arrays.  Also called key-value pairs (variable-value pairs).  Conditions  Involve a behavior and a consequence.  Usually an if-then or an if-then-else statement.

8 System Command Programming © Wiley Publishing. 2006. All Rights Reserved.  Can run any Command Line command in a PHP program.  Below is an example of a PC System Directory Listing <? echo " "; system("dir"); echo " "; ?>  The System function is only for Command Line applications, not for graphical applications.

9 Embedded SQL © Wiley Publishing. 2006. All Rights Reserved.  Embedded SQL makes the Web application easier to debug if errors occur.  SQL statements for a PHP file are created the same way as in the Query Builder in SQL view.  Each SQL statement is set equal to a variable.

10 Error Checking © Wiley Publishing. 2006. All Rights Reserved.  Error checking consists of validating text that is entered into forms.  Most common error checking, especially if users are entering data into a database, is to prevent blank responses.  A conditional statement checks one or more variables for empty (NULL) values.

11 Discussion Topics What are variables? How can I incorporate a loop into my program? Is there a correct way to combine HTML and PHP? How do I handle form data?


Download ppt "Introduction To PHP 20 * Introducing the basics of programming * Discovering variables, loops, arrays and conditions * Integrating HTML and PHP Stations."

Similar presentations


Ads by Google