MySQL

<?php
session_start ();
?>

<form method="POST" action="./form20241008.php">
<input type="text" name="form20241008001"></input>
<input type="submit">
</form>

<?php
echo session_id () . "<br>\n";

setcookie ("form20241008002", "Ich bin das erste Keks", time () + 1200);

echo htmlentities ($_POST ["form20241008001"]) . "<br>\n";
echo htmlentities ($_COOKIE ["form20241008002"]) . "<br>\n";
echo htmlentities ($_COOKIE ["form20241008003"]) . "<br>\n";

session_destroy ();
?>
HTTP-Request
POST https://nextcloud.ituenix.de/david/20241008/form20241008.php HTTP/1.1
host: localhost
Cookie: form20241008003=Ich bin das zweite Keks
Content-Length: 63
Content-Type: application/x-www-form-urlencoded

form20241008001=Ich bin das Date, feel welcome with our cookies
out:
Trying ::1...
Connected to localhost.
Escape character is '^]'.
HTTP/1.1 200 OK
Date: Tue, 08 Oct 2024 17:30:30 GMT
Server: Apache/2.4.62 (Debian)
Set-Cookie: PHPSESSID=q50q0s5j446lbj4n0icvde8j2d; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: form20241008002=Ich%20bin%20das%20erste%20Keks; expires=Tue, 08 Oct 2024 17:50:30 GMT; Max-Age=1200
Vary: Accept-Encoding
Content-Length: 248
Content-Type: text/html; charset=UTF-8


<form method="POST" action="./form20241008.php">
<input type="text" name="form20241008001"></input>
<input type="submit">
</form>

q50q0s5j446lbj4n0icvde8j2d<br>
Ich bin das Date, feel welcome with our cookies<br>
<br>
Ich bin das zweite Keks<br>
MySQL Abfrage
<?php
session_start ();
include ("/home/david/MySQLTEST.php");

$db = new PDO ("mysql: host=localhost", $db_user, $db_password);

$sql = "CREATE DATABASE mysqltest20241008; ";
$db->query ($sql);

try {
    $sql = "USE mysqltest20241008; ";
    $db-> query ($sql);

    $sql = "CREATE TABLE X (x1 INTEGER, x2 INTEGER); CREATE TABLE Y (y1 INTEGER, y2 INTEGER); ";
    $db->query ($sql);

    $sql =  "INSERT INTO X (x1, x2) VALUES (0, 0); ";
    $db->query ($sql);
    $sql =  "INSERT INTO X (x1, x2) VALUES (0, 1); ";
    $db->query ($sql);
    $sql =  "INSERT INTO X (x1, x2) VALUES (1, 0); ";
    $db->query ($sql);
    $sql =  "INSERT INTO X (x1, x2) VALUES (1, 1); ";
    $db->query ($sql);
    $sql =  "INSERT INTO X (x1, x2) VALUES (10, 10); ";
    $db->query ($sql);
    $sql =  "INSERT INTO Y (y1, y2) VALUES (0, 0); ";
    $db->query ($sql);
    $sql =  "INSERT INTO Y (y1, y2) VALUES (0, 1); ";
    $db->query ($sql);
    $sql =  "INSERT INTO Y (y1, y2) VALUES (10, 10); ";
    $db->query ($sql);

    $sql = "SELECT x1, x2 FROM X; ";
    $stmt = $db->query ($sql);
    while ($row = $stmt -> fetch ())
        echo $row [0] . ", " . $row [1] . "; ";
    echo "<br>\n";


    $sql = "SELECT y1, y2 FROM Y; ";
    $stmt = $db->query ($sql);
    while ($row = $stmt -> fetch ())
        echo $row [0] . ", " . $row [1] . "; ";
    echo "<br>\n";


    $sql = "SELECT y1, y2 FROM X LEFT JOIN Y WHERE X.x1 = Y.y2; ";
    $stmt = $db->query ($sql);
    while ($row = $stmt -> fetch ())
        echo $row [0] . ", " . $row [1] . ", " . $row [2] . ", " . $row [3] . "; ";
    echo "<br>\n";

    $sql = "DROP DATABASE mysqltest20241008; ";
    $db->query ($sql);

}

catch (Exception $e) {
    $sql = "DROP DATABASE mysqltest20241008; ";
    $db->query ($sql);
}

session_destroy ();
?>
output:
0, 0; 0, 1; 1, 0; 1, 1; 10, 10; <br>
0, 0; 0, 1; 10, 10; <br>