fetch matches by searching through the database on match.php

The main aspect of the website we are trying to create is to return other user’s information after the signed in user has searched or filtered for a match. Just like in any normal online dating website, a user can filter the results by selecting a certain age, height, eye-colour, hair-colour, etc. And then the results are returned to the user and they are presented with the user’s profile information. Currently a logged in user can be click to the match.php page and is shown this screenshot below:

Screen Shot 2015-04-14 at 18.17.11

This is the code used for match.php:

Screen Shot 2015-04-16 at 18.44.52

There needs to be a form for the user to select features of other user’s such as the filters mentioned above and then a submit/search button to return the results.

So, I changed the PHP code to the screenshots below:

Screen Shot 2015-04-16 at 18.46.11

This screenshot shows the PHP used to return the results, it uses if variables and searches the data from the users table.

Screen Shot 2015-04-16 at 18.46.20

Below is a screenshot of the different user’s that have signed up to the website and their data is stored in the users table.

Screen Shot 2015-04-16 at 19.07.08

If a user was searching for another user who had blonde hair, blue eyes, 19 years old and studied Tourism Management they would be returned with the result Holly Banks as shown from the two screenshots below:

Screen Shot 2015-04-16 at 19.08.56

Screen Shot 2015-04-16 at 19.09.16

This is also shown in the screen recording below:

Advertisements

Registering users data and connecting to phpMyAdmin

The next task I set for myself was to register the user’s details after they sign-up and connect it to the database. Therefore, I had to create a separate php called register.php

register.php
Screen Shot 2015-04-14 at 19.18.34

To allow the data entered by the user in the sign-up form to transfer to the database in phpMyAdmin, I used the highlighted php code below. This query inserts the username, password, firstname, lastname, age, gender, university course, biography, smoker, hair, drinker, height and, eye colour into the database.Screen Shot 2015-04-14 at 19.22.27

The below data was entered on the sign-up form and then the register button is clicked.
Screen Shot 2015-04-14 at 19.26.12

To check if the data was then inserted into the users table, I logged into phpMyAdmin and browsed the users table and as you can see below all the data was transferred.Screen Shot 2015-04-14 at 19.26.55