Path : /home/vishqocm/pcib.in/
File Upload :
Current File : /home/vishqocm//pcib.in/create_table.php

<?php
// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "popularcomputer";

// 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 IF NOT EXISTS `unified_certificates` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `enrollment_id` int(11) NOT NULL,
  `student_exam_id` int(11) NULL,
  `course_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `certificate_number` varchar(50) NOT NULL,
  `verification_code` varchar(50) NOT NULL,
  `certificate_data` text,
  `issue_date` date NOT NULL,
  `payment_status` enum('pending','paid','completed') NOT NULL DEFAULT 'pending',
  `payment_date` datetime DEFAULT NULL,
  `payment_reference` varchar(100) DEFAULT NULL,
  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `certificate_number` (`certificate_number`),
  UNIQUE KEY `verification_code` (`verification_code`),
  KEY `enrollment_id` (`enrollment_id`),
  KEY `student_exam_id` (`student_exam_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8";

if ($conn->query($sql) === TRUE) {
    echo "Table unified_certificates created successfully";
} else {
    echo "Error creating table: " . $conn->error;
}

$conn->close();
?>