home
/
u941026986
/
domains
/
express.paratune.com
/
public_html
➕ New
📤 Upload
✎ Editing:
add_sent_xml_columns.php
← Back
<?php /** * Standalone script to add sent_xml columns to bol_main and manifest_main tables * * Usage: php add_sent_xml_columns.php * * This script will try to read from .env file, or use the values below */ // Try to load .env file $envFile = __DIR__ . '/.env'; if (file_exists($envFile)) { $lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($lines as $line) { if (strpos(trim($line), '#') === 0) continue; if (strpos($line, '=') !== false) { list($key, $value) = explode('=', $line, 2); $key = trim($key); $value = trim($value); if ($key === 'DB_HOST') $host = $value; if ($key === 'DB_DATABASE') $database = $value; if ($key === 'DB_USERNAME') $username = $value; if ($key === 'DB_PASSWORD') $password = $value; if ($key === 'DB_PORT') $port = $value; } } } // Database configuration - UPDATE THESE VALUES if .env is not available $host = $host ?? 'localhost'; $database = $database ?? 'your_database_name'; $username = $username ?? 'your_username'; $password = $password ?? 'your_password'; $port = $port ?? '3306'; try { // Connect to database $pdo = new PDO("mysql:host=$host;port=$port;dbname=$database;charset=utf8mb4", $username, $password); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); echo "Connected to database successfully.\n\n"; // Check and add column to bol_main echo "Checking bol_main table...\n"; $stmt = $pdo->query("SHOW COLUMNS FROM `bol_main` LIKE 'sent_xml'"); if ($stmt->rowCount() == 0) { $pdo->exec("ALTER TABLE `bol_main` ADD COLUMN `sent_xml` LONGTEXT NULL AFTER `more_data`"); echo "✓ Added sent_xml column to bol_main table\n"; } else { echo "⚠ Column sent_xml already exists in bol_main table\n"; } // Check and add column to manifest_main echo "Checking manifest_main table...\n"; $stmt = $pdo->query("SHOW COLUMNS FROM `manifest_main` LIKE 'sent_xml'"); if ($stmt->rowCount() == 0) { $pdo->exec("ALTER TABLE `manifest_main` ADD COLUMN `sent_xml` LONGTEXT NULL AFTER `more_data`"); echo "✓ Added sent_xml column to manifest_main table\n"; } else { echo "⚠ Column sent_xml already exists in manifest_main table\n"; } echo "\nDone!\n"; } catch (PDOException $e) { echo "Error: " . $e->getMessage() . "\n"; exit(1); }
💾 Save Changes
Cancel
📤 Upload File
×
Select File
Upload
Cancel
➕ Create New
×
Type
📄 File
📁 Folder
Name
Create
Cancel
✎ Rename Item
×
Current Name
New Name
Rename
Cancel
🔐 Change Permissions
×
Target File
Permission (e.g., 0755, 0644)
0755
0644
0777
Apply
Cancel