<?php
setcookie ("MyCookie30", "This is Cookie", time () + 3600);
echo $_COOKIE ["MyCookie30"];
?>
<?php
include ('/home/david/mysqldata.php');
$handle = mysql_connect ("127.0.0.1", $MYSQL_NAME, $MYSQL_PASSWORD);
mysql_query ("USE test011", $handle);
mysql_query ("INSERT INTO abc VALUES (\"005\", \"006\")", $handle);
$result = mysql_query ("SELECT * FROM abc JOIN def");
while ($row = mysql_fetch_row ($result))
echo $row [0] . " " . $row [1] . " " . $row [2] . " " . $row [3] . "<br>\n";
mysql_close ($handle);
?>
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<header></header>
<main></main>
<footer></footer>
<form method="GET" action="./form.php">
<input type="text" name="text1"></input>
<input type="submit"></input>
</form>
</body>
</html>
<?php
echo htmlentities($_GET ["text1"]);
?>
david@intel-compute-stick:~$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 622
Server version: 10.5.12-MariaDB-0+deb11u1 Debian 11
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> CREATE DATABASE test011;
Query OK, 1 row affected (0.084 sec)
MariaDB [(none)]> USE test011;
Database changed
MariaDB [test011]> CREATE TABLE abc (abc01 VARCHAR (32), abc02 VARCHAR (32));
Query OK, 0 rows affected (0.249 sec)
MariaDB [test011]> CREATE TABLE def (def01 VARCHAR (32), def02 VARCHAR (32));
Query OK, 0 rows affected (0.079 sec)
MariaDB [test011]> INSERT INTO abc VALUES ("001", "003");
Query OK, 1 row affected (0.073 sec)
MariaDB [test011]> INSERT INTO abc VALUES ("002", "004");
Query OK, 1 row affected (0.035 sec)
MariaDB [test011]> INSERT INTO def VALUES ("001", "002");
Query OK, 1 row affected (0.042 sec)
MariaDB [test011]> INSERT INTO def VALUES ("002", "004");
Query OK, 1 row affected (0.032 sec)
MariaDB [test011]> SELECT * FROM abc;
+-------+-------+
| abc01 | abc02 |
+-------+-------+
| 001 | 003 |
| 002 | 004 |
+-------+-------+
2 rows in set (0.026 sec)
MariaDB [test011]> SELECT * FROM def;
+-------+-------+
| def01 | def02 |
+-------+-------+
| 001 | 002 |
| 002 | 004 |
+-------+-------+
2 rows in set (0.032 sec)
MariaDB [test011]> SELECT * FROM abc JOIN def;
+-------+-------+-------+-------+
| abc01 | abc02 | def01 | def02 |
+-------+-------+-------+-------+
| 001 | 003 | 001 | 002 |
| 002 | 004 | 001 | 002 |
| 001 | 003 | 002 | 004 |
| 002 | 004 | 002 | 004 |
+-------+-------+-------+-------+
4 rows in set (0.027 sec)
MariaDB [test011]> QUIT
Bye
david@intel-compute-stick:~$
david@intel-compute-stick:~$ php /var/www/html/011/database.php
001 003 001 002<br>
001 003 002 004<br>
002 004 001 002<br>
002 004 002 004<br>
005 006 001 002<br>
005 006 002 004<br>
david@intel-compute-stick:~$