<?php /* * Following code will list all the products */ // include db connect class require_once __DIR__ . '/db_connect.php'; // connecting to db $db = new DB_CONNECT(); echo "init db : creation tables"; $sql = "CREATE TABLE IF NOT EXISTS PRODUCTS (\npid INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,\nname VARCHAR(100) NOT NULL,\nprice DECIMAL(10,2) NOT NULL,\ndescription TEXT,\ncreated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\nupdated_at timestamp NULL DEFAULT NULL\n)"; if ($db->query($sql) === TRUE) { echo "Table Products created successfully"; } else { echo "Error creating table: " . $db->error; } $db->close();