diff --git a/app/model/Teamtable.php b/app/model/Teamtable.php index daefedc..3781b99 100644 --- a/app/model/Teamtable.php +++ b/app/model/Teamtable.php @@ -87,7 +87,8 @@ class Teamtable } // Return true if team exists, false if not - public function insert(string $cardnumber): bool + // ;)) + public function recieveStick(string $cardnumber): bool { $sth = $this->dbh->prepare('SELECT * FROM lagtabell WHERE Kortnummer = ?'); $sth->execute([$cardnumber]); @@ -105,7 +106,7 @@ class Teamtable "INSERT INTO `lagtabell` (`LagNavn`, `Bedrift`, `Kortnummer`, `Lagleder`, `Telefon`, `Deltagere`, `Runder`) VALUES (?, ?, ?, ?, ?, ?, ?)" ); $template = $this->emptyTeamTemplate; - $template = [ + $sth->execute([ $template['LagNavn'], $template['Bedrift'], $cardnumber, @@ -113,8 +114,7 @@ class Teamtable $template['Telefon'], $template['Deltagere'], $template['Runder'], - ]; - $sth->execute($template); + ]); return FALSE; } } \ No newline at end of file diff --git a/public/simulator.php b/public/simulator.php index 60034e5..4d442a6 100644 --- a/public/simulator.php +++ b/public/simulator.php @@ -9,7 +9,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') $cardnumber = $_POST['cardnumber']; if (!(strlen($cardnumber) > 32)) { - if ($model->insert($cardnumber)) + if ($model->recieveStick($cardnumber)) { $app->session->flash("Lag funnet for \"{$cardnumber}\"", "success"); } else {