20 lines
492 B
PHP
20 lines
492 B
PHP
<?php
|
|
|
|
$sqla = "SELECT Ortname FROM Orte;";
|
|
$resulta = $db->query($sqla);
|
|
|
|
while ($nta = $resulta->fetch_assoc()) {
|
|
if ($nta['Ortname'] == $_POST['Ort']) {
|
|
exit();
|
|
}
|
|
}
|
|
|
|
$sqls = 'INSERT INTO Orte (ID, Ortname) VALUES (NULL, "'.$_POST['Ort'].'");';
|
|
$stmts = $db->prepare($sqls);
|
|
if (!$stmts) {
|
|
die ('Datensatz konnte nicht angelegt werden: '.$db->error);
|
|
}
|
|
if (!$stmts->execute()) {
|
|
die ('Datensatz konnte nicht angelegt werden: '.$stmts->error);
|
|
}
|