The following files exists in this folder. Click to view.
add-words.php
api/
components/
include.php
index.php
ini/
login.php
logout.php
practice.php
progress.php
public/
scripts/
util/
word.php
word.php
47 lines ASCII Windows (CRLF)
<?php
include "include.php";
$word = quick_statment("SELECT * FROM word WHERE id=?", "i", $_GET["id"])->fetch_assoc();
$translations = quick_statment("SELECT * FROM translation WHERE word_id = ?", "i", $word["id"]);
if ($_GET["delete"]) {
// delte word, translations and translation settings and tries
foreach ($translations as $translation) {
quick_statment("DELETE FROM try_record WHERE translation_id=?", "i", $translation["id"]);
quick_statment("DELETE FROM translation_settings WHERE translation_id=?", "i", $translation["id"]);
quick_statment("DELETE FROM translation WHERE id=?", "i", $translation["id"]);
}
quick_statment("DELETE FROM word WHERE id=?", "i", $word["id"]);
header("Location: " . path_to_url((BASE_PATH . "/index.php")));
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php include "components/head.php" ?>
</head>
<body>
<?php include "components/header.php"; ?>
<main>
<p><?php echo $word["word"]; ?></p>
<?php foreach ($translations as $translation) { ?>
<p><?php echo $translation["translation"] ?></p>
<?php } ?>
<form action="">
<input name="id" value="<?php echo $_GET["id"] ?>" hidden>
<input name="delete" value="true" hidden>
<button>delete</button>
</form>
</main>
</body>
</html>