note 130157 added to language.control-structures
| From: | Anonymous | Date: | Tue, 18 Mar 2025 06:03:37 +0000 |
| Subject: | note 130157 added to language.control-structures | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221988@lists.php.net to get a copy of this message | ||
<!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>
<?php
// Verbindung zur Datenbank herstellen mit PDO
$servername = "mysql";
$username = "root";
$password = "htlkrems";
$dbname = "classicmodels";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username,
$password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die("Verbindung fehlgeschlagen: " . $e->getMessage());
}
$id = isset($_GET['id']) ? $_GET['id'] : null;
if ($id) {
$stmt = $conn->prepare("SELECT * FROM customers WHERE customerNumber =
:id");
$stmt->bindParam(':id', $id, PDO::PARAM_STR);
$stmt->execute();
$results = $stmt->fetch(PDO::FETCH_ASSOC);
} else {
$results = false; // Falls keine ID übergeben wurde
}
?>
<?php
if ($results) { // Ãberprüfung, ob Ergebnisse vorhanden sind
echo "<table class='table table-striped'>";
echo "<tr>";
echo "<th>customerNumber</th>";
echo "<th>customerName</th>";
echo "<th>contactLastName</th>";
echo "<th>contactFirstName</th>";
echo "<th>phone</th>";
echo "<th>addressLine1</th>";
echo "<th>addressLine2</th>";
echo "<th>city</th>";
echo "<th>state</th>";
echo "<th>postalCode</th>";
echo "<th>country</th>";
echo "<th>salesRepEmployeeNumber</th>";
echo "<th>creditLimit</th>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $results['customerNumber'] .
"</td>";
echo "<td>" . $results['customerName'] .
"</td>";
echo "<td>" . $results['contactLastName'] .
"</td>";
echo "<td>" . $results['contactFirstName'] .
"</td>";
echo "<td>" . $results['phone'] . "</td>";
echo "<td>" . $results['addressLine1'] .
"</td>";
echo "<td>" . $results['addressLine2'] .
"</td>";
echo "<td>" . $results['city'] . "</td>";
echo "<td>" . $results['state'] . "</td>";
echo "<td>" . $results['postalCode'] .
"</td>";
echo "<td>" . $results['country'] . "</td>";
echo "<td>" . $results['salesRepEmployeeNumber'] .
"</td>";
echo "<td>" . $results['creditLimit'] .
"</td>";
echo "</tr>";
echo "</table>";
} else {
echo "<p>Keine Employee mit dieser Checknummer gefunden.</p>";
}
?>
</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.control-structures.php
Edit -- https://main.php.net/note/edit/130157
Del: integrated -- https://main.php.net/note/delete/130157/integrated
Del: useless -- https://main.php.net/note/delete/130157/useless
Del: bad code -- https://main.php.net/note/delete/130157/bad+code
Del: spam -- https://main.php.net/note/delete/130157/spam
Del: non-english -- https://main.php.net/note/delete/130157/non-english
Del: in docs -- https://main.php.net/note/delete/130157/in+docs
Del: other reasons-- https://main.php.net/note/delete/130157
Reject -- https://main.php.net/note/reject/130157
Search -- https://main.php.net/manage/user-notes.php