MDN wants to learn about developers like you:

Learn web development

How websites work with databases

This page is not complete.

One of the most useful applications of the Web is its capability to link a website with a database so web surfers can search for information. Not only can the Web serve up data, it can also collect it. For example, many websites ask users to "register" their names, addresses, and other demographic information, which is then captured and stored in a database.

Prerequisites: You need to first know the client/server model of the Internet.
Objective: You will learn how websites work with databases.

How websites work with databases


  1. Websites like Google, Yahoo!, and Bing include a search dialog box in which you enter a keyword that represents the subject matter you are looking for. The search begins on a web page that includes a form field to accept search items and HTML codes. Clicking the search button sends a request from the browser to the web server to bring back a list of all the websites that contain your keyword. 
  2. When you execute the search, the web server passes your search information to a CGI script, which then searches the database. A search on Google for soccer games would produce this URL:
  3. When the web server receives this URL, it identifies the URL as a trigger for a CGI script and passes it along with the search criteria ("soccer games," in this example) to the miniprogram using CGI. The CGI script then sends the search to the database.
  4. The database retrieves the record or records that match the search criteria and returns the data to the web server via CGI in a form of a new HTML page. The server then sends the page back to the client browser as a new HTML page.

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, Jeremie, StephenKelly, AfeefRb
 Last updated by: Jeremie,