SlideShare a Scribd company logo
PHP and Rich
Internet Applications
           Mike Potter
    http://www.riapedia.com/
    mike.potter@adobe.com
Fast



Easy
<?php

if (!$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')) {
!! echo 'Could not connect to mysql';
!! exit;
}

if (!mysql_select_db('mysql_dbname', $link)) {
!! echo 'Could not select database';
!! exit;
}

$sql! ! = 'SELECT foo FROM bar WHERE id = 42';
$result = mysql_query($sql, $link);

if   (!$result) {
!!   echo "DB Error, could not query the databasen";
!!   echo 'MySQL Error: ' . mysql_error();
!!   exit;
}

mysql_free_result($result);

return($result);
?>
function PMA_getSearchSqls($table, $search_str, $search_option)
{
         global $err_url, $charset_connection;
         // Statement types
         $sqlstr_select = 'SELECT';
         $sqlstr_delete = 'DELETE';
         // Fields to select
         $res                    = PMA_DBI_query('SHOW ' . (PMA_MYSQL_INT_VERSION >= 40100 ? 'FULL ' : '') . 'FIELDS FROM ' . PMA_backquote($table) . '
FROM ' . PMA_backquote($GLOBALS['db']) . ';');
         while ($current = PMA_DBI_fetch_assoc($res)) {
              if (PMA_MYSQL_INT_VERSION >= 40100) {
                  list($current['Charset']) = explode('_', $current['Collation']);
             }
              $current['Field'] = PMA_backquote($current['Field']);
              $tblfields[]       = $current;
         } // while
         PMA_DBI_free_result($res);
         unset($current, $res);
         $tblfields_cnt           = count($tblfields);
         // Table to use
         $sqlstr_from = ' FROM ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($table);
         // Beginning of WHERE clause
         $sqlstr_where      = ' WHERE';
         $search_words      = (($search_option > 2) ? array($search_str) : explode(' ', $search_str));
         $search_wds_cnt = count($search_words);
         $like_or_regex     = (($search_option == 4) ? 'REGEXP' : 'LIKE');
         $automatic_wildcard     = (($search_option <3) ? '%' : '');
         for ($i = 0; $i < $search_wds_cnt; $i++) {
              // Eliminates empty values
              // In MySQL 4.1, if a field has no collation we get NULL in Charset
              // but in MySQL 5.0.x we get ''
              if (!empty($search_words[$i])) {
                  for ($j = 0; $j < $tblfields_cnt; $j++) {
                      if (PMA_MYSQL_INT_VERSION >= 40100 && $tblfields[$j]['Charset'] != $charset_connection && $tblfields[$j]['Charset'] != 'NULL' &&
$tblfields[$j]['Charset'] != '') {
                           $prefix = 'CONVERT(_utf8 ';
                           $suffix = ' USING ' . $tblfields[$j]['Charset'] . ') COLLATE ' . $tblfields[$j]['Collation'];
                      } else {
                           $prefix = $suffix = '';
                      }
                      $thefieldlikevalue[] = $tblfields[$j]['Field']
                                            . ' ' . $like_or_regex . ' '
PHP and Rich Internet Applications
www.riapedia.com
PHP and Rich Internet Applications
RIA Characteristics

• Full applications
• Could replace desktop apps
• Applications, not web pages
PHP and Rich Internet Applications
PHP and Rich Internet Applications
What’s in it

     for me?
for my employer?
Rich Internet Applications
                   “             are the next evolution of the
                                 web.
                                         ”
Source: Gartner Research, May 11, 2005
Builds on existing skills
    and knowledge
$
Saved ~160 GB in 3 hrs
User experience
    matters
Client Options
• Ajax (In Browser)
• Java (Sun)
• XUL (Mozilla)
• XAML (Microsoft)
• MXML (Adobe Flex)
Ajax Examples
XUL Examples
XUL Examples

    Songbird
XAML Examples
PHP and Rich Internet Applications
PHP and Rich Internet Applications
PHP and Rich Internet Applications
PHP and Rich Internet Applications
To Think About
• Reach - How many people will view this
  application? What platform will they be on?
  Is it an open or closed platform?
• Rich - Can I integrate rich content easily,
  like video, audio and animations?
• Tools - What will I use to build this
  application? How will I debug?
PHP and RIAs


• Read in XML from a PHP backend (REST)
REST with PHP
<?php

//connect to the database
mysql_connect ...

//get the data
mysql_query( “SELECT * from recipes”);
...

//transform into XML

print “<recipes><recipe id=’1’ name=’cake’/><recipe id=’2’
name=’hotdog’/></recipes>”;

?>
PHP and Rich Internet Applications
PHP and Rich Internet Applications
PHP and RIAs

• Transfer PHP objects to the client directly

• JSON - JavaScript Object Notation
• AMF - ActionScript Messaging Format
JSON and PHP
PHP and Rich Internet Applications
PHP and Rich Internet Applications
PHP and Rich Internet Applications
PHP and Rich Internet Applications
Flex with AMFPHP
<?php

//connect to the database
mysql_connect ...

//get the data
$ResultObject = mysql_query( “SELECT * from recipes”);
...

return( mysql_fetch_object( $ResultObject ) );

?>
How to make money?
How to make money?
Recap

• Build PHP apps as services that can be used
  by any front end - Ajax, XAML, Flex etc...
• Rich clients and components allow you to
  simplify your PHP code
What’s next?
Web Compiler for
   Flex Applications
• http://labs.adobe.com

• Allows you to create MXML, ActionScript,
  upload to the server and compile there,
  similar to developing PHP applications
PHP and Rich Internet Applications
Apollo enables...
•   Offline / Occasionally Connected
•   Applications can run in background
•   Network
•   HTTP
•   XML-RPC / SOAP / Rest based web services
•   Binary and XML sockets
•   File I/O
•   Local storage / Settings API
•   Custom Chrome
•   Shape
•   Alpha
PHP and Rich Internet Applications
PHP and Rich Internet Applications
THANK YOU!

More Related Content

PDF
PHP and Rich Internet Applications
TXT
My shell
PDF
Blog Hacks 2011
PPTX
21. CodeIgniter search
PDF
Laravel, the right way - PHPConference 2016
PDF
Mojolicious
PDF
Laravel the right way
PHP and Rich Internet Applications
My shell
Blog Hacks 2011
21. CodeIgniter search
Laravel, the right way - PHPConference 2016
Mojolicious
Laravel the right way

What's hot (20)

PDF
Practica csv
PDF
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
PDF
Twib in Yokoahma.pm 2010/3/5
PDF
Pagination in PHP
PPTX
16.mysql stored procedures in laravel
PDF
Pemrograman Web 9 - Input Form DB dan Session
ODP
PDF
Country State City Dropdown in PHP
KEY
第49回Php勉強会@関東 Datasource
PDF
Jqeury ajax plugins
PDF
Add edit delete in Codeigniter in PHP
PPTX
15. CodeIgniter editarea inregistrarilor
PDF
Doctrine MongoDB ODM (PDXPHP)
PDF
Pemrograman Web 8 - MySQL
PPT
Php My Sql
PDF
Introduction to the Pods JSON API
TXT
Xmpp prebind
PDF
YAPC::Asia 2010 Twitter解析サービス
PDF
Current state-of-php
PDF
Undercover Pods / WP Functions
Practica csv
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
Twib in Yokoahma.pm 2010/3/5
Pagination in PHP
16.mysql stored procedures in laravel
Pemrograman Web 9 - Input Form DB dan Session
Country State City Dropdown in PHP
第49回Php勉強会@関東 Datasource
Jqeury ajax plugins
Add edit delete in Codeigniter in PHP
15. CodeIgniter editarea inregistrarilor
Doctrine MongoDB ODM (PDXPHP)
Pemrograman Web 8 - MySQL
Php My Sql
Introduction to the Pods JSON API
Xmpp prebind
YAPC::Asia 2010 Twitter解析サービス
Current state-of-php
Undercover Pods / WP Functions
Ad

Viewers also liked (9)

PDF
REST made simple with Java
PPT
Troubleshooting Deadlocks in SQL Server 2000
PPT
The new era of tenure and teacher evaluation final 1
PDF
Cassandra Nosql
PDF
Tango Database & MySQL Cluster
PPT
Speak asia
KEY
Link Bait & Social Bait
PPTX
4 gwes2012
PDF
How to ChoosHow to Choose A Web Application Framework
REST made simple with Java
Troubleshooting Deadlocks in SQL Server 2000
The new era of tenure and teacher evaluation final 1
Cassandra Nosql
Tango Database & MySQL Cluster
Speak asia
Link Bait & Social Bait
4 gwes2012
How to ChoosHow to Choose A Web Application Framework
Ad

Similar to PHP and Rich Internet Applications (20)

KEY
PDF
Doctrine For Beginners
PDF
Php summary
PDF
関西PHP勉強会 php5.4つまみぐい
PDF
Bootstrat REST APIs with Laravel 5
PPT
PHP Workshop Notes
PDF
Building Lithium Apps
PDF
Dirty Secrets of the PHP SOAP Extension
ZIP
Drupal Development (Part 2)
ZIP
What's new in the Drupal 7 API?
PPTX
RESTful API 제대로 만들기
KEY
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
PDF
Practical PHP 5.3
PDF
Forget about index.php and build you applications around HTTP!
PPTX
Cakefest 2010: API Development
PDF
[PL] Jak nie zostać "programistą" PHP?
PDF
How to write code you won't hate tomorrow
PDF
Advanced symfony Techniques
PDF
Drupal - dbtng 25th Anniversary Edition
PPT
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
Doctrine For Beginners
Php summary
関西PHP勉強会 php5.4つまみぐい
Bootstrat REST APIs with Laravel 5
PHP Workshop Notes
Building Lithium Apps
Dirty Secrets of the PHP SOAP Extension
Drupal Development (Part 2)
What's new in the Drupal 7 API?
RESTful API 제대로 만들기
Remedie: Building a desktop app with HTTP::Engine, SQLite and jQuery
Practical PHP 5.3
Forget about index.php and build you applications around HTTP!
Cakefest 2010: API Development
[PL] Jak nie zostać "programistą" PHP?
How to write code you won't hate tomorrow
Advanced symfony Techniques
Drupal - dbtng 25th Anniversary Edition
PHP and MySQL PHP Written as a set of CGI binaries in C in ...

More from elliando dias (20)

PDF
Clojurescript slides
PDF
Why you should be excited about ClojureScript
PDF
Functional Programming with Immutable Data Structures
PPT
Nomenclatura e peças de container
PDF
Geometria Projetiva
PDF
Polyglot and Poly-paradigm Programming for Better Agility
PDF
Javascript Libraries
PDF
How to Make an Eight Bit Computer and Save the World!
PDF
Ragel talk
PDF
A Practical Guide to Connecting Hardware to the Web
PDF
Introdução ao Arduino
PDF
Minicurso arduino
PDF
Incanter Data Sorcery
PDF
PDF
Fab.in.a.box - Fab Academy: Machine Design
PDF
The Digital Revolution: Machines that makes
PDF
Hadoop + Clojure
PDF
Hadoop - Simple. Scalable.
PDF
Hadoop and Hive Development at Facebook
PDF
Multi-core Parallelization in Clojure - a Case Study
Clojurescript slides
Why you should be excited about ClojureScript
Functional Programming with Immutable Data Structures
Nomenclatura e peças de container
Geometria Projetiva
Polyglot and Poly-paradigm Programming for Better Agility
Javascript Libraries
How to Make an Eight Bit Computer and Save the World!
Ragel talk
A Practical Guide to Connecting Hardware to the Web
Introdução ao Arduino
Minicurso arduino
Incanter Data Sorcery
Fab.in.a.box - Fab Academy: Machine Design
The Digital Revolution: Machines that makes
Hadoop + Clojure
Hadoop - Simple. Scalable.
Hadoop and Hive Development at Facebook
Multi-core Parallelization in Clojure - a Case Study

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Machine learning based COVID-19 study performance prediction
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
cuic standard and advanced reporting.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Cloud computing and distributed systems.
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
A comparative analysis of optical character recognition models for extracting...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Assigned Numbers - 2025 - Bluetooth® Document
A Presentation on Artificial Intelligence
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Unlocking AI with Model Context Protocol (MCP)
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Machine learning based COVID-19 study performance prediction
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
sap open course for s4hana steps from ECC to s4
cuic standard and advanced reporting.pdf
20250228 LYD VKU AI Blended-Learning.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Cloud computing and distributed systems.
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
A comparative analysis of optical character recognition models for extracting...
The AUB Centre for AI in Media Proposal.docx
NewMind AI Weekly Chronicles - August'25-Week II
Assigned Numbers - 2025 - Bluetooth® Document

PHP and Rich Internet Applications

  • 1. PHP and Rich Internet Applications Mike Potter http://www.riapedia.com/ [email protected]
  • 3. <?php if (!$link = mysql_connect('mysql_host', 'mysql_user', 'mysql_password')) { !! echo 'Could not connect to mysql'; !! exit; } if (!mysql_select_db('mysql_dbname', $link)) { !! echo 'Could not select database'; !! exit; } $sql! ! = 'SELECT foo FROM bar WHERE id = 42'; $result = mysql_query($sql, $link); if (!$result) { !! echo "DB Error, could not query the databasen"; !! echo 'MySQL Error: ' . mysql_error(); !! exit; } mysql_free_result($result); return($result); ?>
  • 4. function PMA_getSearchSqls($table, $search_str, $search_option) { global $err_url, $charset_connection; // Statement types $sqlstr_select = 'SELECT'; $sqlstr_delete = 'DELETE'; // Fields to select $res = PMA_DBI_query('SHOW ' . (PMA_MYSQL_INT_VERSION >= 40100 ? 'FULL ' : '') . 'FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($GLOBALS['db']) . ';'); while ($current = PMA_DBI_fetch_assoc($res)) { if (PMA_MYSQL_INT_VERSION >= 40100) { list($current['Charset']) = explode('_', $current['Collation']); } $current['Field'] = PMA_backquote($current['Field']); $tblfields[] = $current; } // while PMA_DBI_free_result($res); unset($current, $res); $tblfields_cnt = count($tblfields); // Table to use $sqlstr_from = ' FROM ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($table); // Beginning of WHERE clause $sqlstr_where = ' WHERE'; $search_words = (($search_option > 2) ? array($search_str) : explode(' ', $search_str)); $search_wds_cnt = count($search_words); $like_or_regex = (($search_option == 4) ? 'REGEXP' : 'LIKE'); $automatic_wildcard = (($search_option <3) ? '%' : ''); for ($i = 0; $i < $search_wds_cnt; $i++) { // Eliminates empty values // In MySQL 4.1, if a field has no collation we get NULL in Charset // but in MySQL 5.0.x we get '' if (!empty($search_words[$i])) { for ($j = 0; $j < $tblfields_cnt; $j++) { if (PMA_MYSQL_INT_VERSION >= 40100 && $tblfields[$j]['Charset'] != $charset_connection && $tblfields[$j]['Charset'] != 'NULL' && $tblfields[$j]['Charset'] != '') { $prefix = 'CONVERT(_utf8 '; $suffix = ' USING ' . $tblfields[$j]['Charset'] . ') COLLATE ' . $tblfields[$j]['Collation']; } else { $prefix = $suffix = ''; } $thefieldlikevalue[] = $tblfields[$j]['Field'] . ' ' . $like_or_regex . ' '
  • 8. RIA Characteristics • Full applications • Could replace desktop apps • Applications, not web pages
  • 11. What’s in it for me? for my employer?
  • 12. Rich Internet Applications “ are the next evolution of the web. ” Source: Gartner Research, May 11, 2005
  • 13. Builds on existing skills and knowledge
  • 14. $
  • 15. Saved ~160 GB in 3 hrs
  • 16. User experience matters
  • 17. Client Options • Ajax (In Browser) • Java (Sun) • XUL (Mozilla) • XAML (Microsoft) • MXML (Adobe Flex)
  • 20. XUL Examples Songbird
  • 26. To Think About • Reach - How many people will view this application? What platform will they be on? Is it an open or closed platform? • Rich - Can I integrate rich content easily, like video, audio and animations? • Tools - What will I use to build this application? How will I debug?
  • 27. PHP and RIAs • Read in XML from a PHP backend (REST)
  • 28. REST with PHP <?php //connect to the database mysql_connect ... //get the data mysql_query( “SELECT * from recipes”); ... //transform into XML print “<recipes><recipe id=’1’ name=’cake’/><recipe id=’2’ name=’hotdog’/></recipes>”; ?>
  • 31. PHP and RIAs • Transfer PHP objects to the client directly • JSON - JavaScript Object Notation • AMF - ActionScript Messaging Format
  • 37. Flex with AMFPHP <?php //connect to the database mysql_connect ... //get the data $ResultObject = mysql_query( “SELECT * from recipes”); ... return( mysql_fetch_object( $ResultObject ) ); ?>
  • 38. How to make money?
  • 39. How to make money?
  • 40. Recap • Build PHP apps as services that can be used by any front end - Ajax, XAML, Flex etc... • Rich clients and components allow you to simplify your PHP code
  • 42. Web Compiler for Flex Applications • http://labs.adobe.com • Allows you to create MXML, ActionScript, upload to the server and compile there, similar to developing PHP applications
  • 44. Apollo enables... • Offline / Occasionally Connected • Applications can run in background • Network • HTTP • XML-RPC / SOAP / Rest based web services • Binary and XML sockets • File I/O • Local storage / Settings API • Custom Chrome • Shape • Alpha