summaryrefslogtreecommitdiff
path: root/automated/linux/lemp/html/add-record.php
diff options
context:
space:
mode:
Diffstat (limited to 'automated/linux/lemp/html/add-record.php')
-rw-r--r--automated/linux/lemp/html/add-record.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/automated/linux/lemp/html/add-record.php b/automated/linux/lemp/html/add-record.php
new file mode 100644
index 0000000..955652a
--- /dev/null
+++ b/automated/linux/lemp/html/add-record.php
@@ -0,0 +1,24 @@
+<?php
+$servername = "localhost";
+$username = "root";
+$password = "lemptest";
+$dbname = "myDB";
+
+// Create connection
+$conn = mysqli_connect($servername, $username, $password, $dbname);
+// Check connection
+if (!$conn) {
+ die("Connection failed: " . mysqli_connect_error());
+}
+
+$sql = "INSERT INTO MyGuests (firstname, lastname, email)
+VALUES ('John', 'Doe', 'john@example.com')";
+
+if (mysqli_query($conn, $sql)) {
+ echo "New record created successfully";
+} else {
+ echo "Error: " . $sql . "<br>" . mysqli_error($conn);
+}
+
+mysqli_close($conn);
+?>