Тестовое задание #2

Теперь неоходимо добавить отдельной сущностью Жанр и Разработчик (отдельные таблицы) и сохранять Игры с учетом этих данных (есть или нет в базе жанр/разработчик. если нет - добавить или сказать что нет такого, если есть - сохранить) и добавить фильтрацию по жанру/разработчику".

Backend PHP DataBase

You can add new records in the database, edit them and delete. Try it now.
Backend part have a few limitation such as quantity of records and autorefreshing (every 20 minutes) the database with the data by default. So new records you are made are not store in the DB constantly.

Show DB.
Keep in mind that the DB is refreshing every 20 minutes.

Refresh DB. Set DB data by default.

refresh DB Are you sure?

All PHP file codes used in this project are available by clicking the button.

show PHP codes

1. Get All

Get a list of videogames


2. Read (Get Single Row)

Getting one videogame by its id.

show post request example

   "id": "1"

The form below is to send GET request with id. Write an id you want and click the button to see result.

Read single row

3. Create

Create a new videogame.

show post request example

   "name": "Combat",
   "producer": "Sony",
   "category": "Horror"

Add new videogame in the Database and don't forget fill all fields correctly. Quantity of rows has limitation in 12 records.

Add new game by AJAX

Add new game by SUBMIT

4. Update/Edit

Updating always has required to provide the id of data.

show post request example

   "id": "1",
   "name": "Combat"

There is the form to send POST request with updated values. Choose row from the table you want to edit by clicking "insert data in form". After that edit fields with new data and click "update" to see result.

id name producer category
1 DOOM Apple Shooters
2 Warcraft Google Real-time strategy
3 Age of Empires Nintendo Real-time strategy
4 Crash Bandicoot Sega Platformer
5 Forza Motorsport Xbox Simulation
6 Gears of War Bandai Shooters
7 Portal 2 Casio Puzzlers
8 The Long Dark Sony Survival and horror

Update game name by AJAX

Update game name by SUBMIT

5. Delete

Delete one videogame identified by its id.

show post request example
   "id": "1"

You are free to delete any existing row from database. Click the button "delete" to see result.


6. Search

Searching by category or producer

/api/search.php?searchBy={category, producer}&search=
show post request example


There are two forms to send request with name searchBy. Write an searching word you want and click the button to see result.

Search games (GET)

Submit, reload the page

Search games (POST)

AJAX request (json)

DB categories

CategoryId Category

DB videogames

id name producer category

DB producers

ProducerId Producer