The users input such as users comments, log-in, image upload and much more has a database in the background storing the information and then displaying the information when called up with-in the website. With-in this post I will be talking about the database platform used but also designing a database using entity relationship diagrams.
The database platform that we will be using for our website will be MySQL which can either be installed onto the websites server just like wikis or hosted on another server then connected to via the php code, however this can slow down the site as it has to connect to the other server as well which can cause latency problems, so for this project we will be installing it onto our server.
- Allows multiple tables
- Easy to install and setup
- Industry standard tool
- Easy to code for (Queries)
It is important to plan and design the database before creating the database as not only will it save time but will make you think about what tables will be needed and how they interlink creating your life much easier when it comes to coding the website. To do this I will be using a system called Entity Relationship Diagrams (ERD).
But what is an ERD? “An entity-relationship diagram, or ERD, is a chart that visually represents the relationship between database entities. ERDs model an organization’s data storage requirements with three main components: entities, attributes, and relationships.” (https://www.lucidchart.com/pages/what-is-ERD)
I will be using this to create the basic design of how the database will work with one another but first I have to work out what will need a database.
What needs a database?
- Login and Register Service
- Users input
- image upload
I also have to work out what type of data will be stored with-in the database. The different types that I will mainly be using are;
- Varchar – Variable character limit (Names, Citys, Bio)
- Char – Set characters limit (Passwords)
- Text – Text (Comments)
- Enum – Set Data input (Gender)
- Blob – Mulitmedia files (Avatars)
- Uniqueidentifier – Unique Number Generated (Unique ID)
I am now going to combine the ERD and different datatypes to create a basic design for a user picture and comment system, I am going to use a picture from my Facebook as an example and create an ERD with file types.