This commit is contained in:
William 2022-02-16 13:05:13 +01:00
parent b319dd23fd
commit 8ef2098dcd
2 changed files with 5 additions and 5 deletions

View File

@ -87,7 +87,8 @@ class Teamtable
} }
// Return true if team exists, false if not // 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 = $this->dbh->prepare('SELECT * FROM lagtabell WHERE Kortnummer = ?');
$sth->execute([$cardnumber]); $sth->execute([$cardnumber]);
@ -105,7 +106,7 @@ class Teamtable
"INSERT INTO `lagtabell` (`LagNavn`, `Bedrift`, `Kortnummer`, `Lagleder`, `Telefon`, `Deltagere`, `Runder`) VALUES (?, ?, ?, ?, ?, ?, ?)" "INSERT INTO `lagtabell` (`LagNavn`, `Bedrift`, `Kortnummer`, `Lagleder`, `Telefon`, `Deltagere`, `Runder`) VALUES (?, ?, ?, ?, ?, ?, ?)"
); );
$template = $this->emptyTeamTemplate; $template = $this->emptyTeamTemplate;
$template = [ $sth->execute([
$template['LagNavn'], $template['LagNavn'],
$template['Bedrift'], $template['Bedrift'],
$cardnumber, $cardnumber,
@ -113,8 +114,7 @@ class Teamtable
$template['Telefon'], $template['Telefon'],
$template['Deltagere'], $template['Deltagere'],
$template['Runder'], $template['Runder'],
]; ]);
$sth->execute($template);
return FALSE; return FALSE;
} }
} }

View File

@ -9,7 +9,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST')
$cardnumber = $_POST['cardnumber']; $cardnumber = $_POST['cardnumber'];
if (!(strlen($cardnumber) > 32)) { if (!(strlen($cardnumber) > 32)) {
if ($model->insert($cardnumber)) if ($model->recieveStick($cardnumber))
{ {
$app->session->flash("Lag funnet for \"{$cardnumber}\"", "success"); $app->session->flash("Lag funnet for \"{$cardnumber}\"", "success");
} else { } else {