User Tools

Site Tools


en:web_development:databases:exercise

Web Development Lesson 7 - Databases

Exercises

Objective

In this activity you'll use information extracted from a database to display player data in your project.

Setup

  • Create a file called 'players.php' in your 'project' directory in Visual Studio Code.
  • Change the Language Mode to HTML in the bottom right corner.
  • Set up the page to include 'header.php', 'menu.php' and 'footer.php'.

Database

  • Add code to connect to the database 'players'.
  • Set a variable called 'player' to 1.
  • Query the table 'players' for all fields.
  • Store all fields as variables.
  • Display the information as in LINK. Or create your own design. Here are some tips.
    • Set <body> as flex with flex-direction: column. This creates a vertical flex box.
    • Set height of <html> and <body> to 100%.
    • Set flex: 5 for <main>, which ensures <main> is given 5 times more vertical space than the other elements.
    • Set <main> to flex display.
    • Set <main> to flex-wrap: wrap

Next: Summary

en/web_development/databases/exercise.txt · Last modified: 2023/08/16 09:33 (external edit)