summaryrefslogtreecommitdiff
path: root/automated/linux/lemp/html/create-table.php
diff options
context:
space:
mode:
Diffstat (limited to 'automated/linux/lemp/html/create-table.php')
-rw-r--r--automated/linux/lemp/html/create-table.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/automated/linux/lemp/html/create-table.php b/automated/linux/lemp/html/create-table.php
new file mode 100644
index 0000000..cf60a50
--- /dev/null
+++ b/automated/linux/lemp/html/create-table.php
@@ -0,0 +1,30 @@
+<?php
+$servername = "localhost";
+$username = "root";
+$password = "lemptest";
+$dbname = "myDB";
+
+// Create connection
+$conn = new mysqli($servername, $username, $password, $dbname);
+// Check connection
+if ($conn->connect_error) {
+ die("Connection failed: " . $conn->connect_error);
+}
+
+// sql to create table
+$sql = "CREATE TABLE MyGuests (
+id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
+firstname VARCHAR(30) NOT NULL,
+lastname VARCHAR(30) NOT NULL,
+email VARCHAR(50),
+reg_date TIMESTAMP
+)";
+
+if ($conn->query($sql) === TRUE) {
+ echo "Table MyGuests created successfully";
+} else {
+ echo "Error creating table: " . $conn->error;
+}
+
+$conn->close();
+?>