Skip to content
Julen Somet García
FRENES
← All missions

Web WEB-04 · Dec 2024

Video game shop in PHP

Catalogue of video games by category with a cart, in PHP and MariaDB: my first database-backed website.

Role
Web development project at ISIMA (2nd year), in a pair with Jocelin Calas
Stack
  • PHP
  • MariaDB
  • SQL
  • HTML / CSS

AThe context

Starting from a provided MariaDB database (items, categories, VAT, carts), we had to build an online shop in PHP without a framework: display the categories, list the games in each category and manage a cart.

BWhat I did

  • Site layout and stylesheet: header, login and sign-up forms, product cards
  • Display of the list of games in a category from the database
  • Cart: adding an item with pre-tax price calculation, adding up quantities when the item is already in the cart, and emptying the cart
  • Cart summary using a join between the cart and item tables, with the total computed in SQL

CThe challenge

In hindsight, this project mostly taught me what not to do: queries were built by concatenation (hence exposed to SQL injection), database credentials were written in the code and all visitors shared the same cart. Today I would use prepared statements, configuration kept out of the repository and a cart tied to the session.