I have a website that is being built and I need a database expert to take a look at my mysql script, make it efficient, work out some of the bugs, and implement the process into the existing site.
I have a database called “haveswants” that stores a list of “all users” have and want items.
I have a second database called “trades” that stores all potential trades between all users.
Each user has a list that shows the items they have, another list that shows the items they want, and a third list that shows all potential trades that user can make.
The have and want list is created for the user by simply matching the username and have or want type to the items in the haveswants database and then outputting the results.
The potential trades list is created for the user by simply matching the username to the entries in the trades database and outputting all the potential trades that user can be involved in.
I wrote a button script that looks at the haveswants database and updates the potential trades database every time a user adds or removes an item from their have or want list.
Each item has a have and want button associated with it.
What needs to be done in the project is:
- Write a very basic script that outputs a text only version of the have list, want list, and potential trades list on their specific prebuilt pages. The list does not need to sort or do anything other than show the contents of each list. These lists will only be used to test the script that creates/removes the potential trades. (No CSS work needed) This should be very light work.
- Make a general script that will be applied to all have and want buttons. The script will make the have and want buttons “toggle buttons” that pass the item id and state of the button, and username to the “prebuilt script” which updates the haveswants and trades databases. The have and want buttons will be in an ON state for items on the users have and want lists and in an OFF state for items not on the users have and want lists. These buttons call the appropriate function in the prebuilt script below.
- Modify the prebuilt script so that it works efficiently and correctly on the site. The script has 4 functions: addHave, addWant, removeHave , and removeWant.
addHave / addWant: adds an entry to the haveswants database containing user, item, type(have or want).
The function then updates the trades database by adding the potential trades that can be involved with the new entry.
removeHave / removeWant: removes an entry from the haveswants database containing user, item, type(have or want).
The function then updates the trades database by removing the potential trades that are no longer valid because they contain the removed item.