pyolingo/forms/pruefeDuplikat.php

16 lines
470 B
PHP

<?php
require_once __DIR__ . '/../includes/db_connect.php';
$data = json_decode(file_get_contents("php://input"), true);
$wort = $data['wort'] ?? '';
header('Content-Type: application/json');
$stmt = $pdo->prepare("SELECT COUNT(*)
FROM deutsch
WHERE LOWER(wort) = LOWER(:wort);");
$stmt->execute(['wort' => $wort]);
$wortAnzahl = $stmt->fetchColumn();
echo json_encode($wortAnzahl);