Introduction to PHP and MySQL Bootup Open Forums - CTO-Level Technical Interactive Q&A

Introduction to PHP and MySQL Bootup Open Forums - CTO-Level Technical Interactive Q&A
Slide Note
Embed
Share

Dive into the dynamic world of PHP and MySQL as CTO-level experts share key insights at Bootup Open Forums. Explore the client-server model, HTTP protocol, and the role of Apache, MySQL, and PHP in modern web applications. Understand the request-response cycle, security protocols, and how PHP handles HTTP communication efficiently. Join the discussion and enhance your knowledge in this ever-evolving technology landscape.

  • PHP
  • MySQL
  • CTO
  • Technical
  • Interactive

Uploaded on Apr 19, 2025 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. BOF #2 Introduction to PHP and MySQL Bootup Open Forums CTO-level technical introduction to key technology Interactive throughout relevant Q&A will drive content Laptops welcome although not required (not yet) Semi-weekly recommend topics yourself Community involved - lead a BOF yourself

  2. www.bootup.io www.nyphp.com / www.nyphp.org Introduction to PHP and MySQL The Dynamic Duo for a Dynamic Web BOF #2 April 12th, 2010 Hans Zaunere, Managing Member 4/19/2025 2

  3. www.bootup.io www.nyphp.com / www.nyphp.org Overview The Cast and Key Concepts HTTP The Request The Process The Database Putting it All Together 4/19/2025 3

  4. www.bootup.io www.nyphp.com / www.nyphp.org The Cast HTTP, Apache, MySQL and PHP Key concept: client server model This exchange is the request-response cycle HTTP Protocol used to communicate Apache The web server MySQL Provides content/data to display PHP PHPHypertext Preprocessor within Apache AMP: Acronym for three key software components Basis of modern, dynamic, web/internet applications Apache MySQL PHP Provides the transit Provides the data Provides the processing the glue 4/19/2025 4

  5. www.bootup.io www.nyphp.com / www.nyphp.org HTTP HyperText-Transfer-Protocol Key concept: stateless After request-response cycle is over, neither knows of each other One of the issues of security or hi-jacking Cookies are utilized to maintain a session Server keeps knowledge that a client existed, identified by a cookie left on the browser For such things as knowing whether a user is logged in or not Different types of requests GET includes optional query string read-only POST can also include query string write or read HyperText Transfer Protocol Secure HTTPS Encrypts the communication channel through a SSL certificate 4/19/2025 5

  6. www.bootup.io www.nyphp.com / www.nyphp.org The Request Telling PHP What To Do PHP is designed to handle HTTP communication Apache module (other options are available) Embedded into HTML using <?php and ?> tags Provides super-globals for accessing information about the request $_GET GET query string variables $_POST POST variables $_COOKIE Other cookie variables $_SESSION Internal session information using a session ID 4/19/2025 6

  7. www.bootup.io www.nyphp.com / www.nyphp.org The Process HTML The Goods PHP is designed to process hypertext HTML is the HyperText Markup Language, used for giving structure to the information exchanged on the WWW REQUEST: HTTP/1.1 GET /my-script.php?FirstName=David RESPONSE: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"....> <html> <head> <title>Hello World</title> </head> <body> <b> <?php echo "Hello There ".$_GET['FirstName']; ?> </b> <?php echo 'At the tone, the time will be: '.date('r'); ?> </body> </html> Browser then receives and renders the HTML Doesn t know that it s been generated dynamically 4/19/2025 7

  8. www.bootup.io www.nyphp.com / www.nyphp.org The Database SQL The Supplier Data is stored in tables and columns PHP is designed to communicate with databases SQL is the Structured Query Language, used for manipulating and retrieving data SELECT FirstName,LastName, DATE_FORMAT(DoB,'%M, %D, %Y') AS DateOfBirth FROM Users WHERE STRTOUPPER(LEFT(FirstName,1)) = 'H' SQL is also used for complex or relational data SELECT FirstName,LastName,Address1,Address2 FROM Users,Address WHERE R_UserID=UserID AND STRTOUPPER(LEFT(FirstName,1)) = 'H' 4/19/2025 8

  9. www.bootup.io www.nyphp.com / www.nyphp.org Putting It All Together Your Cast and Crew Apache / MySQL / PHP Web browser uses HTTP to make web server request REQUEST: HTTP/1.1 GET /my-script.php?FirstNameFirstLetter=H Web server passes control to PHP PHP uses SQL to query the database and fetch data <?php $FirstNameFirstLetter = mysql_escape_string($_GET['FirstNameFirstLetter']); $Result = mysql_query("SELECT FirstName,LastName, DATE_FORMAT(DoB,'%M, %D, %Y') AS DateOfBirth FROM Users WHERE STRTOUPPER(LEFT(FirstName,1)) = '{$FirstNameFirstLetter}'",$MYDBR); $ResultCount = mysql_num_rows($Result); $ResultArray = array(); for( $i = 0; $i < $ResultCount; ++$i ) { $ResultArray[$i] = mysql_fetch_assoc($Result); } ?> 4/19/2025 9

  10. www.bootup.io www.nyphp.com / www.nyphp.org Putting It All Together The Finale PHP manipulates returned data and processes HTML <!DOCTYPE...> <ul> <?php foreach( $ResultArray as $Key => $Row ): ?> <li><?=$Row['LastName']?>, <?=$Row['FirstName']?> (<?=$Row['DateOfBirth']?>)</li> <?php endforeach; ?> </ul> PHP and the web server use HTTP to respond Web browser receives HTML and displays the results 4/19/2025 10

  11. www.bootup.io www.nyphp.com / www.nyphp.org Thank You hans.zaunere@nyphp.com New York PHP Mailing Lists are free and available to anyone: http://www.nyphp.org/mailinglists.php 4/19/2025 11

More Related Content