funnies/admin/init_db.php
2025-10-25 15:10:38 -04:00

20 lines
544 B
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$db = new SQLite3(__DIR__ . '/../mentalnet_funnies.db');
// Check if the table already exists
$result = $db->querySingle("SELECT name FROM sqlite_master WHERE type='table' AND name='comics'");
if ($result) {
echo " Table 'comics' already exists.";
} else {
$db->exec("CREATE TABLE comics (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
filename TEXT NOT NULL,
description TEXT,
date_added DATETIME DEFAULT CURRENT_TIMESTAMP
)");
echo "✅ Table 'comics' created.";
}
?>