I am learning database and php

I have made a database with a list of my game collection with the following fields,

  1. ID
  2. game_name
  3. game_year
  4. platform
  5. publisher_name
  6. media
  7. owned
  8. finished
  9. completed
  10. launcher

I made this database in phpMyAdmin and would now like to add images of the games and the end of the database. This is for me and will not be going on the internet, so the images will be on my computer, I have searched for answers on the web and can not find any. I want to be able to add the images to the existing database and not setup a PHP script , is there a way to upload images within phpMyAdmin use the folder instead of the blob.

I have displayed the fields above a Localhost but would like to add an image to the page.

So if anybody could help,

OK for this you need to have a new table. Let's call it game_images for now. You will need a minimum of three fields: id (pk) , game_id (fk), filename.

To keep it as simple as possible we'll assume that all your game images are stored in the same folder that is stored in your php code or in other dB table.

When you create a new game. Your form should have the option of uploading images too. When you get to handle the form data in your php file, add the new game as before but crucially, get the last added id before any other operations. You can then use that id, which will be the game_id to add new records to your game_images table. Be aware if you pass multiple images, all with the same html name attribute, the resulting $_FILES array may have a different structure to which you may expect. Try a few things and come back if stuck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.