note 129958 added to reserved.variables.request
| From: | naglpaul417@gmail.com | Date: | Fri, 10 Jan 2025 10:55:57 +0000 |
| Subject: | note 129958 added to reserved.variables.request | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221771@lists.php.net to get a copy of this message | ||
<?php
$dsn = 'mysql:host=mysql;dbname=trackstar';
$user = 'root';
$password = 'htlkrems';
try {
$dbh = new PDO($dsn, $user, $password);
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//Ich hole mir alle Issues aus der Datenbank, wenn ich ein neues Issue erstellen will (egal,
ob Cancel oder Save)
//Wenn mittels 'delete' die jeweilige project_id reinkommt, lösche ich genau
diesen Eintrag
if(isset($_GET['delete'])){
$del = $dbh->prepare("DELETE FROM projects WHERE project_id = :id");
$del->bindParam(':id', $_GET['delete']);
$del->execute();
$countDeletedRows = $del->rowCount();
}
//überprüfe ich, ob der save button auch wirklich gedrückt wurde, wenn //nicht
erstelle ich es nicht
if(isset($_GET['submit'])){
if($_GET['submit'] == "save"){
$current = date("Y-m-d H:i:s");
$create = $dbh->prepare("INSERT INTO issues (category, description,
created_at, project_id) VALUES (:category, :description, :created_at, :project_id)");
$create->bindParam(':category', $_GET['category']);
$create->bindParam(':description', $_GET['description']);
$create->bindParam(':created_at', $current);
$create->bindParam(':project_id',
$_GET['newIssueProjectId']);
$create->execute();
}
if($_GET['submit'] == "update"){
$current = date("Y-m-d H:i:s");
$create = $dbh->prepare("UPDATE projects SET title = :title, description =
:description WHERE project_id = :updatedProject");
$create->bindParam(':title', $_GET['title']);
$create->bindParam(':description', $_GET['description']);
$create->bindParam(':updatedProject',
$_GET['updatedProject']);
$create->execute();
}
}
$sth = $dbh->query("SELECT * FROM projects");
$projects = $sth->fetchAll(PDO::FETCH_ASSOC);
#$sth->execute();
#var_dump($projects);
} catch (PDOException $e) {
echo 'Verbindung fehlgeschlagen: ' . $e->getMessage();
}
?>
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 193.170.70.27)
----
Manual Page -- https://php.net/manual/en/reserved.variables.request.php
Edit -- https://main.php.net/note/edit/129958
Del: integrated -- https://main.php.net/note/delete/129958/integrated
Del: useless -- https://main.php.net/note/delete/129958/useless
Del: bad code -- https://main.php.net/note/delete/129958/bad+code
Del: spam -- https://main.php.net/note/delete/129958/spam
Del: non-english -- https://main.php.net/note/delete/129958/non-english
Del: in docs -- https://main.php.net/note/delete/129958/in+docs
Del: other reasons-- https://main.php.net/note/delete/129958
Reject -- https://main.php.net/note/reject/129958
Search -- https://main.php.net/manage/user-notes.php