From fa0fed060e5cb9a2ef365a60a24a576282a86016 Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Mon, 2 Oct 2023 21:29:53 +0530 Subject: Lab04: Add database table creation php file + Docker configuration for AMP+phpmyadmin --- Lab04/create_table.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Lab04/create_table.php (limited to 'Lab04/create_table.php') diff --git a/Lab04/create_table.php b/Lab04/create_table.php new file mode 100644 index 0000000..1cc0069 --- /dev/null +++ b/Lab04/create_table.php @@ -0,0 +1,38 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +// Select the database +$conn->select_db($database); + +// Create table +$sql = "CREATE TABLE `$tableName` ( + id INT AUTO_INCREMENT PRIMARY KEY, + fname VARCHAR(50) NOT NULL, + lname VARCHAR(50) NOT NULL, + gender VARCHAR(10), + phone VARCHAR(15), + email VARCHAR(100), + city VARCHAR(50), + department VARCHAR(50) +)"; + +if ($conn->query($sql) === TRUE) { + echo "Table created successfully"; +} else { + echo "Error creating Table: " . $conn->error; +} + +$conn->close(); +?> \ No newline at end of file -- cgit v1.2.3