Database Reference
In-Depth Information
CHAPTER 18
Introduction to MySQL on the Web
18.0. Introduction
This chapter and the next few discuss how MySQL helps you build a better website. One
significant benefit is a more interactive site; MySQL makes it easier to provide dynamic
content rather than static content. Static content exists as pages in the web server's
document tree that are served exactly as is. Visitors can access only the documents that
you place in the tree, and changes occur only when you add, modify, or delete those
documents. By contrast, dynamic content is created on demand. Rather than opening
a file and serving its contents directly to the client, the web server executes a script that
generates the page and sends the resulting output. For example, a script can process a
keyword request and return a page that lists items in a catalog that match the keyword.
Each time a keyword is submitted, the script produces a result appropriate for the re‐
quest. And that's just for starters; web scripts have access to the power of the program‐
ming language in which they're written, so the actions they perform to generate pages
can be quite extensive. For example, web scripts are important for form processing, and
a single script may be responsible for generating a form and sending it to the user,
processing the contents of the form when the user submits it later, and storing the
contents in a database. Scripts that operate this way interact with visitors to your website
and tailor the information provided according to what they want to see.
This chapter covers the introductory aspects of writing scripts that use MySQL in a web
environment. It establishes the groundwork for using your database within the context
of web programming. The topics covered here include:
• How web scripting differs from writing static HTML documents or scripts intended
to be executed from the command line.
Prerequisites for running web scripts. In particular, you must have a web server
installed and it must be set up to recognize your scripts as programs to be executed,
rather than as static files to be served without change over the network.
 
Search WWH ::




Custom Search