Chapter 5. User-Driven Querying
In
this
chapter, we build on the querying techniques discussed in Chapter 4 and complete our coverage of techniques that
read data from web databases. We focus here on user-driven querying,
in which the user provides data that controls the query process. To
input parameters into the querying process, the user usually selects
or types data into an HTML <form>
environment, or clicks on links that request scripts.
We explain user-driven querying by introducing how to:
Pass data from a web browser to a web server.
Access user data in scripts.
Secure interactive query systems.
Query databases with user data.
Produce one script that contains an HTML
<form>
and the code that outputs the query results. We call this a combined script.Develop results pages with previous page and next page links.
Use five-step querying to produce components for user input.
Our case-study example in this chapter is the wine browsing component of the winestore. Similar to most user-driven modules, the wine browsing component has two subcomponents: first, the search bar allows the user to enter a type of wine as a criteria for a database query; and, second, the results pages show the user the wines that match the criteria entered in the search bar. The search bar is shown in Figure 5-1 at the base of the winestore search page, and the results of running the query are presented above it in a results page. The results pages allow the user to view the wines in pages of 12 wines each, move ...
Get Web Database Applications with PHP, and MySQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.