Skip to content

BoshiEddie/nba

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome

Hi there, this is my NBA PHP website project

Below you will find more information about the website

Enjoy 👀

NBA

NBA

So, why NBA?

  • I love basketball
  • So many great players and so much excitement around the league 🏀

Table of Contents

Click on one of the options:


Code

  • A simple PHP calculation to find out each team's win percentage
//Calculating team win percentage

    $total_games = $team['win'] + $team['loss'];
    $percent = $team['win'] /  $total_games;
    $percent_friendly = number_format( $percent * 100, 1 ) . '%';

    echo $percent_friendly;

👇

GIF

Adding a team image

  • Setting up the directory where images will be saved
    •    // This is the directory where images will be saved
         $target = "../images/";
         $target = $target . basename( $_FILES['image']['name']);
  • Next, we want to add the image to the database
    •    // Add the image to the database
         $query = "INSERT INTO categories (image) VALUES ('$image')";
      
         // execute query
         mysqli_query($db, $sql);
      
         if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
            $msg = "Image uploaded successfully";
            }else{
            $msg = "Failed to upload image";
           }
         }
         $result = mysqli_query($db, "SELECT * FROM images");
  • Finally we want to display it on the page
    • // Displaying the image
      <form action="add_team.php" method="post" enctype="multipart/form-data" id="add_category_form">
        <input type="file" name="image" id="image" style="padding-top:20px">
        <input id="add_category_button" type="submit" value="Add">
      </form>

Team Image


Features

Adding new player and editing existing player

GIF

GIF

  • Is that all?
    • Of course not, users can also add or delete a team and view the current standings!

Made

By:

Renzo W
renwid
github.com/renwid
  • With :atom:
  • and the help google

License

License

About

NBA PHP Website

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published