Re: Das neue Auswendig lernen und die neuen Übungen -

Image Screenshot_20240423_073839

<?php
session_start ();
?>

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

<?php
setcookie ("form20240423b", "Ich bin das erste Keks", time () + 2400);

echo session_id () . "<br>n";

echo htmlentities (\$_POST ["form20240423a"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240423b"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240423c"]) . "<br>n";

session_destroy ();
?>

POST http://localhost/mysql20240217/20240423/form20240423.php HTTP/1.1
host: localhost
Cookie: form20240423c=Ich bin das zweite Keks
Content-Length: 31
Content-Type: application/x-www-form-urlencoded

form20240423a=Ich bin das Datum

<?php
session_start ();

include ("/home/david/mysqldata.php");

\$db = new PDO ("mysql: host=localhst", \$MYSQL_USER, \$MYSQL_PASSWORD);

\$sql = "CREATE DATABASE mysql20240423" . session_id () . "<br>n";
\$db->query (\$sql);

\$sql = "USE mysql20240423" . session_id () . "<br>n";
\$db->query (\$sql);

\$sql = "CREATE TABLE a (x1 INTEGER, x2 INTEGER); CREATE TABLE b (y1 INTEGER, y2 INTEGER); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (0, 0); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (0, 1); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (1, 0); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (1, 1); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (2, 7); ";
\$db->query (\$sql);

\$sql = "INSERT INTO b (y1, y2) VALUSE (0, 1); ";
\$db->query (\$sql);

\$sql = "INSERT INTO b (y1, y2) VALUES (1, 0); ";
\$db->query (\$sql);

\$sql = "INSERT INTO b (y1, y2) VALUES (2, 7); ";
\$db->query (\$sql);

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

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

\$sql = "SELECT x1, x2, y1, y2 FROM a INNER JOIN b ON a.x1 = b.y1; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", "  . \$row [1] . ", " . \$row [2] . ", " . \$row [3] . "<br>n";
echo "<br>n";

\$sql = "DROP DATABASE mysql20240423" . session_id () . "<br>n";
\$db->query (\$sql);

session_destroy ();
?>

<?php
session_start ();

include ("/home/david/mysqldata.php");

\$db = new PDO ("mysql: host=localhost", \$MYSQL_USER, \$MYSQL_PASSWORD);

\$sql = "CREATE DATABASE q20240423" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "USE q20240423" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "CREATE TABLE a (x INTEGER); CREATE TABLE b (x INTEGER); CREATE TABLE c (x INTEGER); ";
\$db->query (\$sql);

for (\$i = 0;  \$i < 24;  \$i++) {
    \$sql = "INSERT INTO a (x) VALUES (" . rand () % 32 . "); ";
    \$sql .= "INSERT INTO b (x) VALUES (" . rand () % 64 . "); ";
    \$sql .= "INSERT INTO c (x) VALUES (" . rand () % 54 . "); ";
    \$db->query (\$sql);
}

\$sql = "SELECT x FROM (SELECT x FROM a UNION SELECT x FROM b) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo ";<br>n";

\$sql = "SELECT x FROM (SELECT x FROM a UNION SELECT x FROM c) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo ";<br>n";

\$sql = "SELECT x FROM (SELECT x FROM b UNION SELECT x FROM c) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo ";<br>n";

\$sql = "SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo ";<br>n";

\$sql = "SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM c) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo ";<br>n";

\$sql = "SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo ";<br>n";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a UNION SELECT x FROM b) x
                INTERSECT
            SELECT x FROM c
    ) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo ";<br>n";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM c) x
                UNION
            SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c) x
    ) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo ";<br>n";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a UNION SELECT x FROM c) x
                INTERSECT
            SELECT x FROM b
    ) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo ";<br>n";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x
                UNION
            SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c) x
    ) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo ";<br>n";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM b UNION SELECT x FROM c) x
                INTERSECT
            SELECT x FROM a
    ) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo ";<br>n";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x
                UNION
            SELECT x FROM (SELECT x FROM c INTERSECT SELECT x FROM c) x
    ) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo ";<br>n";

\$sql = "DROP DATABASE q20240423" . session_id () . "; ";
\$db->query (\$sql);

session_destroy ();
?>

 0 0 0 0 0    0
 1 0 0 0 1    1
 2 0 0 1 0    1
 3 0 0 1 1    1
 4 0 1 0 0    1
 5 0 1 0 1    0
 6 0 1 1 0    0
 7 0 1 1 1    0
 8 1 0 0 0    0
 9 1 0 0 1    0
10 1 0 1 0    1
11 1 0 1 1    1
12 1 1 0 0    1
13 1 1 0 1    1
14 1 1 1 0    1
15 1 1 1 1    0


 1 0 0 0 1    1
 2 0 0 1 0    1
 3 0 0 1 1    1
 4 0 1 0 0    1
10 1 0 1 0    1
11 1 0 1 1    1
12 1 1 0 0    1
13 1 1 0 1    1
14 1 1 1 0    1


Gruppe 1:
 1 0 0 0 1    1
 2 0 0 1 0    1
 4 0 1 0 0    1
Gruppe 2:
 3 0 0 1 1    1
10 1 0 1 0    1
12 1 1 0 0    1
Gruppe 3:
11 1 0 1 1    1
13 1 1 0 1    1
14 1 1 1 0    1


1:3         0 0 - 1
2:10        - 0 1 0
2:3         0 0 1 -
4:12        - 1 0 0
3:11        - 0 1 1
10:11       1 0 1 -
10:14       1 - 1 0
12:13       1 1 0 -
12:14       1 1 - 0


1:3         0 0 - 1
12:14       1 1 - 0
2:3         0 0 1 -
10:11       1 0 1 -
12:13       1 1 0 -
10:14       1 - 1 0
4:12        - 1 0 0
3:11        - 0 1 1
2:10        - 0 1 0


Gruppe 1:
1:3         0 0 - 1
Gruppe 2:
12:14       1 1 - 0

Gruppe 1:
2:3         0 0 1 -
Gruppe 2:
10:11       1 0 1 -
12:13       1 1 0 -

10:14       1 - 1 0

Gruppe 1:
4:12        - 1 0 0
2:10        - 0 1 0
Gruppe 2:
3:11        - 0 1 1




1:3                 0 0 - 1
12:14               1 1 - 0

Gruppe 1:
2:3         0 0 1 -
Gruppe 2:
10:11       1 0 1 -
12:13       1 1 0 -

2:3:10:11           - 0 1 -
12:13               1 1 0 -

10:14               1 - 1 0

Gruppe 1:
4:12                - 1 0 0
2:10        - 0 1 0
Gruppe 2:
3:11        - 0 1 1

2:10:3:11           - 0 1 -



1:3                 0 0 - 1
12:14               1 1 - 0
2:3:10:11           - 0 1 -
12:13               1 1 0 -
10:14               1 - 1 0
4:12                - 1 0 0
2:10:3:11           - 0 1 -



1:3                 0 0 - 1
12:14               1 1 - 0
2:3:10:11           - 0 1 -
2:10:3:11           - 0 1 -
12:13               1 1 0 -
10:14               1 - 1 0
4:12                - 1 0 0



1:3                 0 0 - 1
12:14               1 1 - 0
2:3:10:11           - 0 1 -
12:13               1 1 0 -
10:14               1 - 1 0
4:12                - 1 0 0

                1   2   3   4   10  11  12  13  14
1:3             *       *
12:14                                   *       *
2:3:10:11           *   *       *   *
12:13                                   *   *
10:14                           *               *
4:12                        *           *


                1   2   3   4   10  11  12  13  14
1:3             *       *                               p
12:14                                   *       *
2:3:10:11           *   *       *   *                   p
12:13                                   *   *           p
10:14                           *               *
4:12                        *           *               p


                1   2   3   4   10  11  12  13  14
1:3             *       *                               p
2:3:10:11           *   *       *   *                   p
12:13                                   *   *           p
10:14                           *               *
4:12                        *           *               p


1:3                 0 0 - 1
2:3:10:11           - 0 1 -
12:13               1 1 0 -
10:14               1 - 1 0
4:12                - 1 0 0

        y <=    (not x3 and not x2 and x0) or
                (not x2 and x1) or
                (x3 and x2 and not x1) or
                (x3 and x1 and not x0) or
                (x2 and not x1 and not x0);

library ieee;
use ieee.std_logic_1164.all;

entity quine20240423 is
port (
    x3, x2, x1, x0: in std_logic;
    y: out std_logic
);
end;

architecture behaviour of quine20240423 is
begin
        y <=    (not x3 and not x2 and x0) or
                (not x2 and x1) or
                (x3 and x2 and not x1) or
                (x3 and x1 and not x0) or
                (x2 and not x1 and not x0);
end;

library ieee;
use ieee.std_logic_1164.all;

entity quine20240423testbench is
port (
    y: out std_logic
);
end;

architecture behaviour of quine20240423testbench is
    component quine20240423
    port (
        x3, x2, x1, x0: in std_logic;
        y: out std_logic
    );
    end component;
    signal x3, x2, x1, x0: std_logic;
begin
    q: quine20240423 PORT MAP (x3=>x3, x2=>x2, x1=>x1, x0=>x0, y=>y);

library ieee;
use ieee.std_logic_1164.all;

entity quine20240423 is
port (
    x3, x2, x1, x0: in std_logic;
    y: out std_logic
);
end;

architecture behaviour of quine20240423 is
begin
        y <=    (not x3 and not x2 and x0) or
                (not x2 and x1) or
                (x3 and x2 and not x1) or
                (x3 and x1 and not x0) or
                (x2 and not x1 and not x0);
end;

library ieee;
use ieee.std_logic_1164.all;

entity quine20240423testbench is
port (
    y: out std_logic
);
end;

architecture behaviour of quine20240423testbench is
    component quine20240423
    port (
        x3, x2, x1, x0: in std_logic;
        y: out std_logic
    );
    end component;
    signal x3, x2, x1, x0: std_logic;
begin
    q: quine20240423 PORT MAP (x3=>x3, x2=>x2, x1=>x1, x0=>x0, y=>y);
    x0 <= '0' after 0 ns, '1' after 10 ns, '0' after 20 ns, '1' after 30 ns, '0' after 40 ns, '1' after 50 ns, '0' after 60 ns, '1' after 70 ns, '0' after 80 ns, '1' after 90 ns, '0' after 100 ns, '1' after 110 ns, '0' after 120 ns, '1' after 130 ns, '0' after 140 ns, '1' after 150 ns;

    x1 <= '0' after 0 ns, '0' after 10 ns, '1' after 20 ns, '1' after 30 ns, '0' after 40 ns, '0' after 50 ns, '1' after 60 ns, '1' after 70 ns, '0' after 80 ns, '0' after 90 ns, '1' after 100 ns, '1' after 110 ns, '0' after 120 ns, '0' after 130 ns, '1' after 140 ns, '1' after 150 ns;

    x2 <= '0' after 0 ns, '0' after 10 ns, '0' after 20 ns, '0' after 30 ns, '1' after 40 ns, '1' after 50 ns, '1' after 60 ns, '1' after 70 ns, '0' after 80 ns, '0' after 90 ns, '0' after 100 ns, '0' after 110 ns, '1' after 120 ns, '1' after 130 ns, '1' after 140 ns, '1' after 150 ns;

    x3 <= '0' after 0 ns, '0' after 10 ns, '0' after 20 ns, '0' after 30 ns, '0' after 40 ns, '0' after 50 ns, '0' after 60 ns, '0' after 70 ns, '1' after 80 ns, '1' after 90 ns, '1' after 100 ns, '1' after 110 ns, '1' after 120 ns, '1' after 130 ns, '1' after 140 ns, '1' after 150 ns;
end;

Image Screenshot_20240423_162721

<?php
session_start ();

include ("/home/david/mysqldata.php");

\$db = new PDO ("mysql: host=localhst", \$MYSQL_USER, \$MYSQL_PASSWORD);

\$sql = "CREATE DATABASE mysql20240423" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "USE mysql20240423" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "CREATE TABLE a (x1 INTEGER, x2 INTEGER); CREATE TABLE b (y1 INTEGER, y2 INTEGER); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (0, 0); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (0, 1); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (1, 0); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (1, 1); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (2, 7); ";
\$db->query (\$sql);

\$sql = "INSERT INTO b (y1, y2) VALUES (0, 1); ";
\$db->query (\$sql);

\$sql = "INSERT INTO b (y1, y2) VALUES (1, 0); ";
\$db->query (\$sql);

\$sql = "INSERT INTO b (y1, y2) VALUES (2, 7); ";
\$db->query (\$sql);

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

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

\$sql = "SELECT x1, x2, y1, y2 FROM a INNER JOIN b ON a.x1 = b.y1; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", "  . \$row [1] . ", " . \$row [2] . ", " . \$row [3] . "<br>n";
echo "<br>n";

\$sql = "DROP DATABASE mysql20240423" . session_id () . "; ";
\$db->query (\$sql);

session_destroy ();
?>