I have created a new database on my PHPmyAdmin account that will store the information which users will post to the website. The table contains the following fields:
This will be a unique ID that will be linked to the post. i have set the data type as an integer, as it will be displayed as numerical data and given it a minimum digit of 10. I’ve also set this to be an Auto increment, which means that the data will be automatically ordered.
Name of Business
This is simply the name of the business in which the user is posting about. This has been set as a VARCHAR data type, as this is text. I have set it to have a maximum of 40 characters.
This field will contain information about what category the business falls under. I have used the ENUM data type for this field, as the user will have the option to pick from 5 options: food, clothes, night clubs, gyms or electronics.
This is a rating out of 5 that the user thinks the business deserves. This has been set as a Enum, again because the user has a choice of options that they can make, in this case, rating it from 1 to 5.
This is where the main body of information will be, a description of what the business does and their offers. I’ve set this is a text data type, as it would need more information that what a VARCHAR offers.
This will be a timestamp of when the post was made by the user. I’ve set the default as current timestamp, so it displays this information in the database.
This field will store information about which user made the post. Similarly to name of business field, I have used a VARCHAR data type, but set the maximum characters as 10.
Going forward, the next step is to link the database to our existing code, so that users can post into the database.