Learning Mysql



Download 4.24 Mb.
View original pdf
Page361/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   358   359   360   361   362   363   364   365   366
Learning MySQL
4. Process
2. Find the file shop.php in the document root
3. Pass the parameters- item = 12
- quantity = 4
1. Connect to www.invyhome.com request /shop.php?item=12&quantity=4
6. Return output to client
5. Return output of shop.php
(generally HTML)
Web browser software
Figure 13-2. The steps to run shop.php
398 | Chapter 13:
Web Database Applications

tion, security features, input validation, user session management, the database access library, SQL queries, and other functionality. The database tier is the database server itself, along with its databases, indexes, and utilities. For the applications we discuss in this chapter, the MySQL server is the database tier, and the Apache web server and
PHP are the middle tier. Any popular browser can be used as a client.
We’ve previously broadly discussed what makes three-tier-architecture software—that is, web database applications—different from conventional software. In the context of a three-tier architecture, the browser is a very thin client—that is, very little of the application logic resides there. Instead, the middle tier carries out almost all of the application functions, and the browser usually displays only static HTML content. The exception is when the HTML page contains embedded JavaScript—or scripts written in another client-side language—that adds basic interactive features to the web pages;
for example, JavaScript is often used to animate menus, highlight options as the mouse passes over them, alert the user with popup windows, and perform other simple tasks.
We don’t discuss client-side scripting further in this book there are several good resources listed on the topic at the end of this chapter.
Most of the application logic is captured in PHP scripts in the middle tier. These are invoked when a user requests a resource from the web server, and the web server calls the PHP engine that runs the script. Of course, because all the scripts are accessible with a web browser, users can request any script, anytime, from anywhere. This creates unique problems. Web database applications must robustly handle users making unexpected requests bookmarking and returning to pages later reloading or refreshing pages when they shouldn’t; or simply disappearing, never to be seen again. Applications must also protect against the threat of accidental damage or malicious attacks. All this is made more difficult by the HTTP protocol that’s used for communication between web browsers and servers. HTTP has no high-level concept of state. Every request from a browser must contain all information needed to answer the request, since the server forgets all about it once the request is answered. We explain solutions to some of these problems in Chapter The database tier is very similar to that in nonweb applications. The MySQL server listens for connections from clients, such as the MySQL monitor, and authenticates users when they connect. Once the connection is established, the user can run queries,
Database server
Web server
User with web browser
Host running web and database servers
Figure 13-3. A three-tiered web database application

Download 4.24 Mb.

Share with your friends:
1   ...   358   359   360   361   362   363   364   365   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page