Welcome to AJAX with LAMP Workshop Hussain Fakhruddin [email_address]
Overview of LAMP Introduction Client Server Model, What are web servers What is PHP? Why Use PHP? PHP Crash Course Language Reference: Variables, Controls, Loops etc.
Introduction
What is PHP PHP: Hypertext Preprocessor Why not HTP or HP or HPP? Recursive Acronym An acronym in which the first letter of the first word is represented by the acronym itself. GNU = “GNU is NOT UNIX” PHP: PHP Hypertext Preprocessor
Why Use PHP If you want to add dynamic content to your pages If you want to make your pages easier to maintain If you’re learning your first "real" computing language If you need a solution that’s portable across multiple platforms (e.g. Red Hat Linux to Windows 2000) If you like free software or need a free solution Examples of uses of PHP & MySQL: Sign-up Forms Surveys Polls Email a Postcard Content Management
What you need to start a website? What you need? Server PHP parser Configurations.
Some basic configurations Save all your file in Run from browser as http://localhost/ < FILENAME > Open any Text Editor and start coding
PHP Crash Course (cont.) Embedding PHP in HTML <html> <body> <strong>Hello World!</strong><br /> <?php echo ‘My name is HussuLinux!’; ?> </body> </html> PHP tag styles: XML: <?php ?>, Short: <? ?>, ASP: <% %> Script: <script language=‘php’></script>
PHP Crash Course (cont.) Adding dynamic content by adding the date to the page. <html> <body> <strong>Hello World!</strong><br /> <? echo ‘Today is’; echo date(‘H:i jS F’); ?> </body> </html> Date() http://www.php.net/manual/en/function.date.php PHP Function Reference http://www.php.net/manual/en/funcref.php One useful function is phpinfo(). Gives system information so you can quickly find out what’s on your machine.
Using PHP to Query a MySQL Database <html> <body> <h1>A List of Users Who Have Signed Up For OscarPool</h1> <? $dbh = mysql_connect(&quot;localhost&quot;,“dbusername&quot;,“dbpassword&quot;) or die(“Couldn't connect to database.&quot;); $db = mysql_select_db(“dbname&quot;, $dbh) or die(“Couldn't select database.&quot;); $sql = “SELECT username, email FROM oscarpool”; $result = mysql_query($sql, $dbh) or die(“Something is wrong with your SQL statement.&quot;); while ($row = mysql_fetch_array($result)) { $username = $row[‘username’]; $email = $row[‘email’]; echo ‘<a href=“mailto:’.$email.’”>’.$username.’</a><br />\n’; } ?> </body> </html>
AJAX
What's Ajax the buzzword Stands for Asynchronous JavaScript and XML Its a web development technique. Its Faster and Interactive.
Who uses Ajax? Gmail Google Maps Meebo Ebuddy And many more
Technology behind AJAX
Why Ajax? Faster, Increase Interactivity Rich User Experience
Steps to AJAX Create a XMLHttpRequest request object Tell the request object where to send the request Tell the object what to do when the request is answered Tell the object to make a request
Lets Code <script language = &quot;javascript&quot;> var XMLHttpRequestObject = false; if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest (); } else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject (&quot;Microsoft.XMLHTTP&quot;); } if (XMLHttpRequestObject) { document.write (&quot;<h1>Welcome to AJAX</h1>&quot;); } </script>
PHP & MySQL Resources Web Sites http://www.php.net/ http://www.phpbuilder.com/ http://www.devshed.com/ http://www.phpmyadmin.net/ http://www.hotscripts.com/PHP/ http://www.mysql.com/ http://www.owasp.org/ Books PHP and MySQL Web Development 2 nd Edition, Welling & Thomson Web Database Applications with PHP & MySQL, O’Reilly Publishers PHP Cookbook, O’Reilly Publishers MySQL Cookbook, O’Reilly Publishers
My special Thanks to: David Olsen ( [email_address] ) for his help in presentation's content. PHP Freaks ( http://www.phpfreaks.com ) This is where I learnt PHP from

Linux Apache Php Mysql Lamp1273

  • 1.
    Welcome to AJAXwith LAMP Workshop Hussain Fakhruddin [email_address]
  • 2.
    Overview of LAMPIntroduction Client Server Model, What are web servers What is PHP? Why Use PHP? PHP Crash Course Language Reference: Variables, Controls, Loops etc.
  • 3.
  • 4.
    What is PHPPHP: Hypertext Preprocessor Why not HTP or HP or HPP? Recursive Acronym An acronym in which the first letter of the first word is represented by the acronym itself. GNU = “GNU is NOT UNIX” PHP: PHP Hypertext Preprocessor
  • 5.
    Why Use PHPIf you want to add dynamic content to your pages If you want to make your pages easier to maintain If you’re learning your first &quot;real&quot; computing language If you need a solution that’s portable across multiple platforms (e.g. Red Hat Linux to Windows 2000) If you like free software or need a free solution Examples of uses of PHP & MySQL: Sign-up Forms Surveys Polls Email a Postcard Content Management
  • 6.
    What you needto start a website? What you need? Server PHP parser Configurations.
  • 7.
    Some basic configurationsSave all your file in Run from browser as http://localhost/ < FILENAME > Open any Text Editor and start coding
  • 8.
    PHP Crash Course(cont.) Embedding PHP in HTML <html> <body> <strong>Hello World!</strong><br /> <?php echo ‘My name is HussuLinux!’; ?> </body> </html> PHP tag styles: XML: <?php ?>, Short: <? ?>, ASP: <% %> Script: <script language=‘php’></script>
  • 9.
    PHP Crash Course(cont.) Adding dynamic content by adding the date to the page. <html> <body> <strong>Hello World!</strong><br /> <? echo ‘Today is’; echo date(‘H:i jS F’); ?> </body> </html> Date() http://www.php.net/manual/en/function.date.php PHP Function Reference http://www.php.net/manual/en/funcref.php One useful function is phpinfo(). Gives system information so you can quickly find out what’s on your machine.
  • 10.
    Using PHP toQuery a MySQL Database <html> <body> <h1>A List of Users Who Have Signed Up For OscarPool</h1> <? $dbh = mysql_connect(&quot;localhost&quot;,“dbusername&quot;,“dbpassword&quot;) or die(“Couldn't connect to database.&quot;); $db = mysql_select_db(“dbname&quot;, $dbh) or die(“Couldn't select database.&quot;); $sql = “SELECT username, email FROM oscarpool”; $result = mysql_query($sql, $dbh) or die(“Something is wrong with your SQL statement.&quot;); while ($row = mysql_fetch_array($result)) { $username = $row[‘username’]; $email = $row[‘email’]; echo ‘<a href=“mailto:’.$email.’”>’.$username.’</a><br />\n’; } ?> </body> </html>
  • 11.
  • 12.
    What's Ajax thebuzzword Stands for Asynchronous JavaScript and XML Its a web development technique. Its Faster and Interactive.
  • 13.
    Who uses Ajax?Gmail Google Maps Meebo Ebuddy And many more
  • 14.
  • 15.
    Why Ajax? Faster,Increase Interactivity Rich User Experience
  • 16.
    Steps to AJAXCreate a XMLHttpRequest request object Tell the request object where to send the request Tell the object what to do when the request is answered Tell the object to make a request
  • 17.
    Lets Code <scriptlanguage = &quot;javascript&quot;> var XMLHttpRequestObject = false; if (window.XMLHttpRequest) { XMLHttpRequestObject = new XMLHttpRequest (); } else if (window.ActiveXObject) { XMLHttpRequestObject = new ActiveXObject (&quot;Microsoft.XMLHTTP&quot;); } if (XMLHttpRequestObject) { document.write (&quot;<h1>Welcome to AJAX</h1>&quot;); } </script>
  • 18.
    PHP & MySQLResources Web Sites http://www.php.net/ http://www.phpbuilder.com/ http://www.devshed.com/ http://www.phpmyadmin.net/ http://www.hotscripts.com/PHP/ http://www.mysql.com/ http://www.owasp.org/ Books PHP and MySQL Web Development 2 nd Edition, Welling & Thomson Web Database Applications with PHP & MySQL, O’Reilly Publishers PHP Cookbook, O’Reilly Publishers MySQL Cookbook, O’Reilly Publishers
  • 19.
    My special Thanksto: David Olsen ( [email_address] ) for his help in presentation's content. PHP Freaks ( http://www.phpfreaks.com ) This is where I learnt PHP from