PHP and MySQL



index
Disabled back button Next Section
printable version

Section 0: Module Objectives or Competencies
Course Objective or Competency
The student will be able to write basic PHP applications in order to connect to and manipulate a database using PHP.
The student will be able to utilize a wide range of features available in MySQL.
Section 1: Overview

These notes are derived, in part, from this chapter.

We have two powerful tools at our disposal: the PHP scripting language and the MySQL database engine.

It’s important to understand how these will fit together.

Section 2: Recap

Here is a recap of what happens when a person visits a page on a database-driven web site:

  1. The visitor’s web browser requests the web page using a standard URL.
  2. The web server software recognizes that the requested file is a PHP script, so the server fires up the PHP interpreter to execute the code contained in the file.
  3. Certain PHP commands connect to the MySQL database and request the content that belongs in the web page.
  4. The MySQL database responds by sending the requested content to the PHP script.
  5. The PHP script stores the content into one or more PHP variables, then uses echo statements to output the content as part of the web page.
  6. The PHP interpreter finishes up by handing a copy of the HTML it has created to the web server.
  7. The web server sends the HTML to the web browser as it would a plain HTML file, except that instead of coming directly from an HTML file, the page is the output provided by the PHP interpreter.