How to Add a Database to a Website

As as a professional website designer I often get asked to add a database to a website that already exists on the Net. In this case I received a request to build a database so students could login from any country in the world to view their grades. The administrator can view all students’ records in one location plus add, edit or delete them. Both students and administrators have the ability to either print or save records to a CSV file.

Requirements

Domain name
If it’s a new website you’ll need to register a domain name. Select a domain that illustrates the purpose of your website so it’s abundantly clear to visitors they have arrived at the right place. Keep it as short as possible so it will be easy to spell and remember.

Web Hosting
When searching for a reliable web hosting company make sure it uses Linux servers with cpanel (control panel for managing your website and mySQL databases). Make sure you have enough space and bandwidth to host your database website. Ask if they keep daily backups of your website files in case your site gets hacked or corrupted. With this kind of security in place you’ll be able to quickly restore your website should it go off-line.

MySQL database
Most popular web hosting companies include MySQL databases in their hosting plans. For this project I only needed one MySQL database to store and manage all the information. My client’s current website was hosted on a Windows server which didn’t allow mySQL databases so I created a new domain hosted on Linux servers.

Database software
Instead of building the database from scratch costing my client thousands of dollars, I used database software. This substantially reduced the time and effort needed to create an effective database. Most of the time spent was understanding my client’s needs then converting those needs to an efficient and usable database that can be integrated into a website to be accessed online by students and administrators.

Steps for adding database to a website

Step 1. Create mySQL database on the server

  • Login to cpanel-mySQL databases
  • Create mySQL database
  • Create user and password
  • Add user to database

Step 2. Create database tables

  • Download and install PHPMagicPlus to desktop
  • Build Grade sheet table containing multiple fields
  • Generate database files from the database application
  • Upload generated files to the server
  • Connect to mySQL database

Step 3. Setup admin interface

PHPMagicPlus allows you to create member accounts and control the privileges of members. For each table in my application, I control whether students can add new records, edit existing ones, and/or delete records. I can also control which records a student can edit and/or delete: only his own records (records added by the student himself), or his group’s records (records added by any student of the group to which a student belongs), or all records entered by him and any other student of any group.

For this database I set-up permissions for students to view, edit their records but not delete them. I created a Superuser group with permission to view, edit, add, delete students from the table. Only the administrator can function as the Superuser and also has access to the backend admin panel. Within the admin panel the administrator can add a new student, email their new username and password, change ownership of student records or add new groups if needed.

Step 4. How to add database to website

The software automatically generates all the web pages containing the database files. The main files contain header and footer includes files which enables you to add a custom header and footer to each page. For the header file I included the meta tags, header banner and navigation menu. For the footer I included the contact information. The CSS generated file enabled me to style the fonts. (Click the banner above to view the example website).

How the database works within the website

  • Superuser creates a new student record in Grades table
  • Administrator logs into the admin area to add a new student (add member)
  • Administrator changes the ownership of that record (view members records)
  • Student automatically receives login link in his email box
  • Administrator emails student login info (UN and PW)
  • Student can now login to view his own record
  • Superuser has ability to view, add, edit, delete students’ records as needed

To create and add a database to a website is not a simple task. The main frustration was converting the needs of the client to the correct functionality of the database. The needs changed many times throughout the process. My recommendation is for the client to write down all his needs and how the database should function before the designer actually begins building the database.

Related articles

Top 7 Benefits of creating a database driven website
How to Build a Database Driven Web Site
How to Backup mySQL Database With phpMyAdmin
Moving WordPress to a New Server Step by Step
How to Use Excel to Import/Export Tables to/from a MySQL Database

********************
Need to create and add a database to your website?
Visit: Web Design in Maryland

Comments

  1. Greetings, I must say fantastic site you have, I stumbled across it in Yahoo. Does the site get much traffic?

  2. Troy Breshears says:

    Didn’t they let you send the thing to a friend (I unfortunately didn’t see the campaign when it was live)? If so, think about the amount of names they collected. The notification emails could contain branding, offers, etc. If they requested opt-in permission, the value of generating a list that large is substantial. Is it targeted? Probably not. But, with effective drip marketing they could filter a pretty qualified list out of it.

Speak Your Mind

*

CommentLuv badge