How to Make a Web Site With a Database

It is easy to create a static website--a website that doesn't change when it is visited. To make a dynamic page, however, that loads and displays information based on interaction with the site visitor, use a database. A database can be used with a web page to display information from the database (as with a catalog), or to display limited, individualized information when a user logs in.

Things You'll Need

  • HTML or text editor
  • Web-enabled database
Show More

Instructions

    • 1

      Decide on the purpose of your database and website. You need to clearly define what your database will do and how people will obtain information from it. Will your database contain information about users who are going to log in? Will it contain information for a game, where information will need to relate directly to each user of the game? Will it display information from a catalog for people to browse? Will it update only from the Internet, or will it be integrated with your company's sales database?

    • 2

      Set up your database. Before you attempt to access it and connect to the website, you need to clearly set up all the tables and fields in the database. Set up the database as completely as possible before you start working on the website. This is critical because once you start accessing the database from the website, changes made to the database could cause web pages that once worked to stop working.

    • 3

      Plan where the web site will interact with the database and, specifically, which pages will interact. It is critical that you know which pages will use the database and how it will use them. Some pages might send data into the database, while others might just read information from the database. Be sure you know which are which--the database might require different information and connection types based on the type of access you desire.

    • 4

      Write the code to provide a connection to the database. This will differ depending on what type of code you are using and what type of database you have. For example, if you are connecting using PHP and MySQL, you will need to create a database connection object in each page that you wish to use to obtain data. If you are using an application such as ColdFusion, however, the connection to the database will have to be set up on the server and the web pages will automatically have access to the database.

    • 5

      Write the rest of the HTML code to use the information from the database, or use a form to get data to insert into the database. Again, depending upon the method of access, the format of the data obtained from the database will be different. All are provided in pre-processors such as PHP and ColdFusion. The pre-processors create plain text web pages to deliver to the end user.

Tips & Warnings

  • Spend time planning at the beginning, and the web development will be easier.

Related Searches:

Comments

You May Also Like

Related Ads

Featured