note 130134 added to features.gc
| From: | Anonymous | Date: | Tue, 11 Mar 2025 05:37:26 +0000 |
| Subject: | note 130134 added to features.gc | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221965@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>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 193.170.70.42)
----
Manual Page -- https://php.net/manual/en/features.gc.php
Edit -- https://main.php.net/note/edit/130134
Del: integrated -- https://main.php.net/note/delete/130134/integrated
Del: useless -- https://main.php.net/note/delete/130134/useless
Del: bad code -- https://main.php.net/note/delete/130134/bad+code
Del: spam -- https://main.php.net/note/delete/130134/spam
Del: non-english -- https://main.php.net/note/delete/130134/non-english
Del: in docs -- https://main.php.net/note/delete/130134/in+docs
Del: other reasons-- https://main.php.net/note/delete/130134
Reject -- https://main.php.net/note/reject/130134
Search -- https://main.php.net/manage/user-notes.php