Using PHP
Upcoming SlideShare
Loading in...5
×
 

Using PHP

on

  • 1,364 views

Peter Brown & Mark Casias talk about PHP and all the great things that go alon

Peter Brown & Mark Casias talk about PHP and all the great things that go alon

Statistics

Views

Total Views
1,364
Views on SlideShare
1,356
Embed Views
8

Actions

Likes
0
Downloads
4
Comments
0

5 Embeds 8

http://webuquerque.com 3
http://www.linkedin.com 2
http://orhowilearnedtolovetheperl.com 1
http://webuquerque.ablognotlimited.com 1
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

Using PHP Using PHP Presentation Transcript

  • USING PHP Peter Brown Mark Casias brown.peterg@gmail.com markie@teampoop.com @litescript @teampoop
  • PHP IS... ...PHP: Hypertext Pre-processor is a scripting language used to add dynamic content to web pages.  ...embedded directly into your HTML code. ...a server-side scripting language, allowing the coder to ignore browser types/versions/specifications. ...extremely popular!
  • PHP IS... ...PHP: Hypertext Pre-processor is a scripting language used to add dynamic content to web pages.  ...embedded directly into your HTML code. ...a server-side scripting language, allowing the coder to ignore browser types/versions/specifications. ...extremely popular! View slide
  • PHP ISN'T... View slide
  • PHP ISN'T... ...a magic bullet.
  • PHP ISN'T... ...a magic bullet. ...necessary for every application.
  • PHP ISN'T... ...a magic bullet. ...necessary for every application. ...pure awesome bottled for your enjoyment after 1 year of conditioning...wait...
  • SOUNDS GREAT (IT IS) - WHAT DO I NEED?
  • SOUNDS GREAT (IT IS) - WHAT DO I NEED? PHP installed and enabled on your server.
  • SOUNDS GREAT (IT IS) - WHAT DO I NEED? PHP installed and enabled on your server. PHP is open-source and free. Download and install it if not already installed on your server.
  • SOUNDS GREAT (IT IS) - WHAT DO I NEED? PHP installed and enabled on your server. PHP is open-source and free. Download and install it if not already installed on your server. Configuration.
  • SOUNDS GREAT (IT IS) - WHAT DO I NEED? PHP installed and enabled on your server. PHP is open-source and free. Download and install it if not already installed on your server. Configuration. Usually done for you.
  • SOUNDS GREAT (IT IS) - WHAT DO I NEED? PHP installed and enabled on your server. PHP is open-source and free. Download and install it if not already installed on your server. Configuration. Usually done for you. PHP set to handle all .php files.
  • SOUNDS GREAT (IT IS) - WHAT DO I NEED? PHP installed and enabled on your server. PHP is open-source and free. Download and install it if not already installed on your server. Configuration. Usually done for you. PHP set to handle all .php files. You can get as intense or simple as you want - check the online manual!
  • SOUNDS GREAT (IT IS) - WHAT DO I NEED? PHP installed and enabled on your server. PHP is open-source and free. Download and install it if not already installed on your server. Configuration. Usually done for you. PHP set to handle all .php files. You can get as intense or simple as you want - check the online manual! Dashing good looks; debonair attitude. 
  • WHERE DO I COME FROM?
  • WHERE DO I COME FROM? Ask your parents, kid...that ain't my racket.
  • WHERE DO I COME FROM? Ask your parents, kid...that ain't my racket. PHP was originally a set of Perl scripts.
  • WHERE DO I COME FROM? Ask your parents, kid...that ain't my racket. PHP was originally a set of Perl scripts. Notice the Perl-like syntax, nerds.
  • WHERE DO I COME FROM? Ask your parents, kid...that ain't my racket. PHP was originally a set of Perl scripts. Notice the Perl-like syntax, nerds.  Original name, "Personal Home Page Tools" - PHP Tools.
  • WHERE DO I COME FROM? Ask your parents, kid...that ain't my racket. PHP was originally a set of Perl scripts. Notice the Perl-like syntax, nerds.  Original name, "Personal Home Page Tools" - PHP Tools. Current PHP version (as of today): 5.3.3
  • YOUR FIRST PHP (subtext: ubiquitous "Hello, world!") <html>     <head>     <title>My First PHP page</title>     </head>     <body>         <?php             echo ("Bonjour, monde!");         ?>     </body> </html> 
  • WHAT JUST HAPPENED?
  • WHAT JUST HAPPENED? PHP is embedded directly into your HTML.
  • WHAT JUST HAPPENED? PHP is embedded directly into your HTML. Begin "PHP mode" using either <?php or <?
  • WHAT JUST HAPPENED? PHP is embedded directly into your HTML. Begin "PHP mode" using either <?php or <? exit "PHP mode" using ?>
  • WHAT JUST HAPPENED? PHP is embedded directly into your HTML. Begin "PHP mode" using either <?php or <? exit "PHP mode" using ?> What's echo(); ?
  • WHAT JUST HAPPENED? PHP is embedded directly into your HTML. Begin "PHP mode" using either <?php or <? exit "PHP mode" using ?> What's echo(); ? echo(); or more simply print(); prints to screen. (<?=$var?>)
  • WHAT JUST HAPPENED? PHP is embedded directly into your HTML. Begin "PHP mode" using either <?php or <? exit "PHP mode" using ?> What's echo(); ? echo(); or more simply print(); prints to screen. (<?=$var?>)  The rest is magic!
  • WHAT JUST HAPPENED? PHP is embedded directly into your HTML. Begin "PHP mode" using either <?php or <? exit "PHP mode" using ?> What's echo(); ? echo(); or more simply print(); prints to screen. (<?=$var?>)  The rest is magic! kidding...
  • LET'S DIVE IN
  • LET'S DIVE IN Functions:
  • LET'S DIVE IN Functions: Basic building blocks.
  • LET'S DIVE IN Functions: Basic building blocks. Create your own; use built in functions (eg, "echo();")
  • LET'S DIVE IN Functions: Basic building blocks. Create your own; use built in functions (eg, "echo();") Syntax: function thename($arg) {      // code to execute goes here }
  • LET'S DIVE IN Functions: Basic building blocks. Create your own; use built in functions (eg, "echo();") Syntax: function thename($arg) {      // code to execute goes here } To call your function: thename();
  • LET'S DIVE IN Functions: Basic building blocks. Create your own; use built in functions (eg, "echo();") Syntax: function thename($arg) {      // code to execute goes here } To call your function: thename(); Variables (super easy): $variablename;
  • FORMS
  • FORMS Get some info! <form name="login" action="script.php" method=”post”>      <input type="text" name="userid" />      <input type="password" name="pass" /> </form>
  • FORMS Get some info! <form name="login" action="script.php" method=”post”>      <input type="text" name="userid" />      <input type="password" name="pass" /> </form> OK that's great...nice form buddy.
  • FORMS Get some info! <form name="login" action="script.php" method=”post”>      <input type="text" name="userid" />      <input type="password" name="pass" /> </form> OK that's great...nice form buddy. First of all: calm down.
  • FORMS Get some info! <form name="login" action="script.php" method=”post”>      <input type="text" name="userid" />      <input type="password" name="pass" /> </form> OK that's great...nice form buddy. First of all: calm down. This is useful! name="" is your variable name.
  • FORMS Get some info! <form name="login" action="script.php" method=”post”>      <input type="text" name="userid" />      <input type="password" name="pass" /> </form> OK that's great...nice form buddy. First of all: calm down. This is useful! name="" is your variable name. eg: <?php $userid; $pass; ?>
  • FORMS Get some info! <form name="login" action="script.php" method=”post”>      <input type="text" name="userid" />      <input type="password" name="pass" /> </form> OK that's great...nice form buddy. First of all: calm down. This is useful! name="" is your variable name. eg: <?php $userid; $pass; ?> OOOOOORRRR you need a SUPER VARIABLE! $_REQUEST, $_POST, $_MOM
  • TIME TO DROWN
  •         TIME TO DROWN                                                                                            
  •         TIME TO DROWN                                                                         - What's going on here?!          - Baby, let me explain...            
  •         TIME TO DROWN                                                                                            
  • GET SOME CLASS
  • GET SOME CLASS Classes are PHP’s Objects
  • GET SOME CLASS Classes are PHP’s Objects Contains variables and methods (functions)
  • GET SOME CLASS Classes are PHP’s Objects Contains variables and methods (functions) Private or Public methods/variables.
  • GET SOME CLASS Classes are PHP’s Objects Contains variables and methods (functions) Private or Public methods/variables. Sample Class:
  • GET SOME CLASS Classes are PHP’s Objects Contains variables and methods (functions) Private or Public methods/variables. Sample Class: class Foo {
  • GET SOME CLASS Classes are PHP’s Objects Contains variables and methods (functions) Private or Public methods/variables. Sample Class: class Foo { public $fighters = ‘good’;
  • GET SOME CLASS Classes are PHP’s Objects Contains variables and methods (functions) Private or Public methods/variables. Sample Class: class Foo { public $fighters = ‘good’; private $nirvana = ‘dead’;
  • GET SOME CLASS Classes are PHP’s Objects Contains variables and methods (functions) Private or Public methods/variables. Sample Class: class Foo { public $fighters = ‘good’; private $nirvana = ‘dead’; public breath($arg) {
  • GET SOME CLASS Classes are PHP’s Objects Contains variables and methods (functions) Private or Public methods/variables. Sample Class: class Foo { public $fighters = ‘good’; private $nirvana = ‘dead’; public breath($arg) { $this->nirvana=‘alive’;
  • GET SOME CLASS Classes are PHP’s Objects Contains variables and methods (functions) Private or Public methods/variables. Sample Class: class Foo { public $fighters = ‘good’; private $nirvana = ‘dead’; public breath($arg) { $this->nirvana=‘alive’; }
  • GET SOME CLASS Classes are PHP’s Objects Contains variables and methods (functions) Private or Public methods/variables. Sample Class: class Foo { public $fighters = ‘good’; private $nirvana = ‘dead’; public breath($arg) { $this->nirvana=‘alive’; } }
  • GET SOME CLASS Classes are PHP’s Objects Contains variables and methods (functions) Private or Public methods/variables. Sample Class: class Foo { public $fighters = ‘good’; private $nirvana = ‘dead’; public breath($arg) { $this->nirvana=‘alive’; } }
  • DATABASE CONNECTABLES
  • DATABASE CONNECTABLES PHP Supports MOST database connections MySQL, Oracle (OCI8), Postgres, Sybase
  • DATABASE CONNECTABLES PHP Supports MOST database connections MySQL, Oracle (OCI8), Postgres, Sybase First, it connects to the database.
  • DATABASE CONNECTABLES PHP Supports MOST database connections MySQL, Oracle (OCI8), Postgres, Sybase First, it connects to the database. Second, it makes it’s SQL query in the flavor.
  • DATABASE CONNECTABLES PHP Supports MOST database connections MySQL, Oracle (OCI8), Postgres, Sybase First, it connects to the database. Second, it makes it’s SQL query in the flavor. It puts the lotion in the bucket.
  • DATABASE CONNECTABLES PHP Supports MOST database connections MySQL, Oracle (OCI8), Postgres, Sybase First, it connects to the database. Second, it makes it’s SQL query in the flavor. It puts the lotion in the bucket. Err I mean: a result set of information returns.
  • EXAMPLE
  • EXAMPLE
  • EXAMPLE <?php mysql_connect(localhost,$username,$password); $query = "SELECT * FROM SEWINGPLANS"; $bucket = mysql_query($query); mysql_close();
  • MORE DB FUN
  • MORE DB FUN Take the resource, and use it. <?php while($bucketArray = mysql_fetch_array($bucket)): echo “$bucketArray[‘skintype’]; endwhile;
  • MORE DB FUN Take the resource, and use it. <?php while($bucketArray = mysql_fetch_array($bucket)): echo “$bucketArray[‘skintype’]; endwhile; You could also make objects out of each row.
  • PHP PLATFORMS Yes, I am in fact, a broken record. Many out there in the world. Zend - Granddaddy of them. Many server solutions CakePHP - MCV implementation CodeIgniter - Better. And many many more
  • CODE IGNITER WIN Best documentation out of all Easiest Model... err.. model You don’t have to conform your data model to their will. Full MCV implementation. PHP Best Practices! http://codeigniter.com/user_guide/general/styleguide.html
  • CONFIGURATION View config with phpinfo(); php.ini file .htaccess files ini_set() function
  • TRULY SCARY!
  • TRULY SCARY!
  • TRULY SCARY! The End
  • TRULY SCARY!