note 130162 added to language.errors
| From: | Anonymous | Date: | Tue, 18 Mar 2025 06:06:18 +0000 |
| Subject: | note 130162 added to language.errors | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221994@lists.php.net to get a copy of this message | ||
<?php
ob_start();
$servername = "mysql";
$username = "root";
$password = "htlkrems";
$dbname = "blog_system";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo " ";
} catch(PDOException $e) {
echo " " . $e->getMessage();
}
$stmt = $conn->prepare("SELECT COUNT(*) AS total_comments FROM comments");
$stmt->execute();
$result = $stmt->fetch(PDO::FETCH_ASSOC);
echo "Gesamtanzahl der Kommentare: " . $result['total_comments'] .
"<br>";
$id = isset($_GET['id']) ? $_GET['id'] : null;
$stmt = $conn->prepare("SELECT * FROM comments WHERE id = :id ");
$stmt->bindParam(':id', $id, PDO::PARAM_STR);
$stmt->execute();
$results = $stmt->fetch(PDO::FETCH_ASSOC);
if($results == null){
echo("kein Kommentar vorhanden");
}
print_r($results);
echo "<td><a class='btn btn-danger' role='button'
href='?del=" . $id. "'>Delete</a></td>";
if(isset($_GET['del'])){
$id = $_GET['del'];
$stmt = $conn->prepare("DELETE FROM comments WHERE id = :id");
$stmt->bindParam('id', $id);
if ($stmt->execute()) {
// Automatische Weiterleitung nach der Löschung
header("Location: index.php");
exit();
}
}
ob_end_flush();
?>
<form method="GET" >
<button type="button"
onclick="window.location.href='index.php'">Reset</button>
</form>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
crossorigin="anonymous">
<title>Document</title>
</head>
<body>
</body>
</html>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 193.170.70.42)
----
Manual Page -- https://php.net/manual/en/language.errors.php
Edit -- https://main.php.net/note/edit/130162
Del: integrated -- https://main.php.net/note/delete/130162/integrated
Del: useless -- https://main.php.net/note/delete/130162/useless
Del: bad code -- https://main.php.net/note/delete/130162/bad+code
Del: spam -- https://main.php.net/note/delete/130162/spam
Del: non-english -- https://main.php.net/note/delete/130162/non-english
Del: in docs -- https://main.php.net/note/delete/130162/in+docs
Del: other reasons-- https://main.php.net/note/delete/130162
Reject -- https://main.php.net/note/reject/130162
Search -- https://main.php.net/manage/user-notes.php