Files
shopfloor-dashboard/db_config.php
cproudlock 6a9bb8c7a4 Initial commit - Shopfloor Dashboard
- Node.js Express server with MySQL integration
- Real-time event dashboard with live updates
- GE Aerospace branding and design
- Auto-refresh every 10 seconds (AJAX)
- Shows current and upcoming events (48 hour window)
- Connection status monitoring
- Optimized for TV display

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 16:17:45 -04:00

34 lines
946 B
PHP

<?php
/**
* Database Configuration for Shopfloor Dashboard
* Connects to ShopDB MySQL database
*/
// Database configuration
define('DB_HOST', 'mysql'); // Docker container name
define('DB_PORT', '3306');
define('DB_NAME', 'shopdb');
define('DB_USER', '570005354');
define('DB_PASS', '570005354');
/**
* Get database connection
* @return PDO Database connection object
*/
function getDbConnection() {
try {
$dsn = "mysql:host=" . DB_HOST . ";port=" . DB_PORT . ";dbname=" . DB_NAME . ";charset=utf8mb4";
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
$pdo = new PDO($dsn, DB_USER, DB_PASS, $options);
return $pdo;
} catch (PDOException $e) {
die("Database Connection Failed: " . htmlspecialchars($e->getMessage()));
}
}
?>