As I discussed my previous post our next goal was to enable users to delete post. Users are now able to do such and the images below show a demonstration of this being performed. As you can see, I wanted to delete the post about Amazon, once it was deleted it was then not viewable in the other category, meaning it had deleted successfully. Being able to delete post is vital in create a professional web application, users may make mistakes and now have the ability to delete these mistakes. For instance my Amazon post wasn’t specific to the Bournemouth location, therefore I didn’t feel it was necessary to show this deal.
As Adam created the table for the posting form I could now go ahead and link the two together. Using similar code to the register form I was able to adjust certain aspects such as the names of rows in my code. Now as you can see in the two images below, when a user enters information into the form it will get sent to the database.
Another aspect to the website we had to include was enabling all users posts to display on the website. Even though it was a small amount of code it was still difficult to perform. Our next step is now more on the style of our website. At this point in time I not quite satisfied with how the forms look also we will properly need to create an account page where people can see all their posts. We also need to make the posts more organised for example adding a sort button.
Today Adam created the table in our database for the form where users will be able to post on the site. This table is slightly different from our register and login table as the user will be entering more information. In this form users will be able to post about the name of business, category, rating and description. The next step is to link this table with the form in our website, I will do this Monday.
As I stated yesterday our next step is to combine our php with our html. One thing I did before this was to create a title page, the page you first see when visiting the site. We did this to give us a chance to explain what the website is about and stands for.
Users now on our real website can register, login and logout. There were a few extra bits of we had to produce to make the site more user-friendly. For example when a user is logged in the login and register button won’t appear as they won’t need it.
To make sure our register form had defiantly connected with our database I got some of my friends from DMD to register to our site. As you can see in the image their username and password have come through, meaning they can now login to our site. Our next step is to enable users to post on the site, to do this we will have to create a new table in our database.
Today my group set out to enable users to register and login to our site. To do this we started with a project file that we had been using with Kyle. This project already enabled users to login to a database but that was all. As you can see in the image below people will now be able to register to the site. We have also added a logout feature once they successfully logged in.
The image below shows the php for the register form. In this block of code we had to perform certain ‘if’ statements when situations would arise. For example if a user was to use a username that was already taken then they wouldn’t be able to register and would be told why. Furthermore when users re-write their password and don’t get it correct they will notified with a message saying ‘passwords don’t match’.
In the image below you can see the index.php, this is where the forms can be edited. While building our php our forms will look very basic as it is more about getting them to work. Once The forms work then I will be able to link them to the website that I have shown in previous posts.
In the last few weeks with Kyle we have been making the backbone to our websites. The first week was relatively simple with just creating and organising the project files. This week I came to a slight halt when trying to connect our PHP to the database. The concept is that whatever is input into the username and password form will then be shown in the database. It may sound simple but I just couldn’t get the two to link together.
As you can see in the image above I was finally able to get the two linked together as you can now see data in the user and password fields. The image below shows the reason why I was able to connect my database. I tried to narrow what might be the main problem and found the two were in fact connected but any data being input in the form wasn’t showing up. I was missing the code between lines 10 and 17, meaning that the now the data input into the form would show in the database.
The ‘echo connected successfully’ code on-line 15 was what I used to narrow my problem. When pressing submit on my form this would display next to the form meaning that it had connected to the database. When try a ‘echo input successfully’ it did not display’. This has given me quite a bit of confidence as I was able to find the issue without having to ask Kyle.
In last weeks seminars we looked into how databases functions through the Entity Relation Model (ERM). An ERM is a diagram that represents the relationships between entities which create the backbone for any database. Entities are (Rouse), “the equivalent of grammatical nouns, such as employees, departments, products, or networks. An entity can be defined by means of its properties, called attributes”.
We also looked into how our databases, PHP and HTML will all link together to display the website. Below is good demonstration of how each component of our website works alongside each other and without one they would all fail.
Going away from our seminars Simon told us to produce our own ERM model for a recipe book. Even though we were told to make our ERM of recipe book I wanted to put my own twist on it. I thought it would be interesting to have my ERM of one of my early ideas so therefore have based my ERM on my holiday idea of posting where you’ve been in the world.
The first category is member and is made of largest amount of data as it must store the vast amount of information that a single user may have. Each of these pieces of data are entities and will be unique to the user. Data such as username, email and password will be essential to the user accessing their account and therefore being able to post on the site. The username along with the avatar will be further useful when differentiating user from user.
The photo and video categories contains certain data about each specific photo and video that is posted on the website. The entities will also be used to identify the image and video, such as photo_ID, filename, description and date stamp. Certain entities from each category need to be linked together so for instance an image can be tracked back a user. The way this is done is through a foreign key. Photo_member_ID is an example of a foreign key I have used. The job of this is to link the member to the image.
The holiday category is the holiday itself. What the user may say about the holiday, for example holiday_text. I also have to add three foreign keys which will link the ERM together. One aspect I added that maybe slightly different to a recipe book ERM is the ‘holiday_video_ID’. In a recipe book website a video may not be necessary but my idea for the holiday posting videos will be core part in the website.
SearchSQLServer,. ‘What Is Entity-Relationship Model (ERM Or ER Model)? – Definition From Whatis.Com’. N.p., 2015. Web. 16 Feb. 2015.