How do I Create a Database of Links & Use That Database to Retrieve Links for a Website?
Creating a database of links for a Website is a way to make the site easier to maintain. A link that changes only needs to be updated in one location: the database. All of the Website pages will then retrieve the updated link. Creating a database of links and retrieving those links for the Website is a two-part process. First, a database must be created. Second, you must build software and Web pages to connect to the database.
Instructions
-
-
1
Design a database schema (or information organization plan). List what information you want to store in the database, such as website link URL, link name, click count, and notes. Also define how the database records relate to each other and how you will sort and retrieve records. For example, you may use an index number to identify and retrieve records from the database. You can change the database once it is built, so don’t worry if you aren’t 100 percent certain at the outset what information you’ll be storing.
-
2
Create one or more database tables using a database management system such as MySQL, Oracle or Access. Tables are the logical structures within a database that store data records. Using your schema as a guide, create the table (or tables) according to the procedure for the database management system you are using.
-
-
3
Add link records to your database table. Once a database table is created, you can add records to the table using the command line or graphical interface of your database management system. Database records represent the actual data, in this case, the links.
-
4
Design a software module to connect a Web page to the database. You’ll need to design and code a software module to connect to your database and access the tables to retrieve link records. The software module connects pages of the Website to the database. For example, MySQL.com describes a database driven Website that uses software written in PHP to retrieve data from a MySQL database.
-
5
Write mark-up language code for your Web pages. You’ll need to write the mark-up language (e.g. HTML) code to include statements that invoke functions in the software module. When a Web page is loaded, the software statements in the mark-up language code are executed by the Website server and link data can be retrieved from the database and inserted into the Web page as it is sent for display.
-
6
Upload the software module and publish the Web pages. Transfer the Web pages, software files and database records to your Website hosting service using an FTP utility program.
-
7
Verify that the software module and Web pages work properly. Access your Web pages. Check the links retrieved from the database. Are the proper links being displayed? Do the links work when clicked? Make any necessary changes.
-
1
Tips & Warnings
For easier and faster testing, install a database and Web server on your local computer and do your testing locally.
Start with a very simple design to test your database, software and Website page code. For example, add one record to your database and try to retrieve that record and display it on a simple Web page. Once that is working, you can expand up to your full design.
References
- Photo Credit Comstock Images/Comstock/Getty Images