use play_a_sport\classes\login;
use play_a_sport\classes\config;
$user = new login();
$val1 = $_POST["email"];
$val2 = $_POST["password"];
$user->setLogins($val1, $val2);
$getvals = $user->getLogins();
$entrduname = $getvals['username'];
$entrdpwd = $getvals['password'];
//echo $getvals['username'];
//echo $getvals['password'];
// We need to have 1 config object with all data in.
$config = new config("localhost", "root", "", "play_a_sport_db", "", "mysqli");
//type in your data hereā€¦
// Now we need to have access to the db class, we uses the config object to configure the db object.
$db = new db($config);
// We can now open the connection to the database.
$db->openConnection();
// If your config details are right, we are now connected to a database, lets test the connection before we run queries.
$are_we_online = $db->pingServer();
// The variable $are_we_online should be true (or 1) if we are connected to the server.
//echo "Are we online: " . $are_we_online; // prints 0 or 1.
// Let us run a query.
$sql = $db->query("SELECT * FROM {admins}");
// The variable $sql will now hold the data returned from the database, we can now work with it.
// Does it have rows ?
/*$hasRows = $db->hasRows($sql);
  echo "Does it have rows: " . $hasRows; // prints 0 or 1 (true or false).
  
  // How many rows does it have.
  $countRows = $db->countRows($sql);
 public function addSport($arr)
 {
     $lname = $arr["loc_name"];
     $ltdd = $arr["lattd"];
     $lngtdd = $arr["longtd"];
     $config = new config("localhost", "root", "", "play_a_sport_db", "", "mysqli");
     $db = new db($config);
     $db->openConnection();
     $result = $db->addNewSportRecord($lname, $ltdd, $lngtdd);
     $db->closeConnection();
     if ($result === TRUE) {
         $url = 'sports.php';
         echo '<META HTTP-EQUIV=REFRESH CONTENT="0; ' . $url . '">';
     } else {
         $_SESSION["inlocname"] = $lname;
         $_SESSION["inltdd"] = $ltdd;
         $_SESSION["inlngtdd"] = $lngtdd;
         $url = 'sport_new.php';
         echo '<META HTTP-EQUIV=REFRESH CONTENT="0; ' . $url . '">';
     }
 }