CoolFace
Apppublic

starinfolab/codecraft-conductor-wizard

sourceHugging Faceupdated 11mo agoView on Hugging Face
0likes
db_connect.php39 linesDownload Raw Back to root
1```php2<?php3$servername = "localhost";4$username = "your_username";5$password = "your_password";6$dbname = "portfolio_db";7 8// Create connection9$conn = new mysqli($servername, $username, $password, $dbname);10 11// Check connection12if ($conn->connect_error) {13    die("Connection failed: " . $conn->connect_error);14}15 16// Create tables if they don't exist17$sql = "CREATE TABLE IF NOT EXISTS projects (18    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,19    title VARCHAR(100) NOT NULL,20    description TEXT NOT NULL,21    image_url VARCHAR(255),22    tags VARCHAR(255),23    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP24)";25 26$conn->query($sql);27 28$sql = "CREATE TABLE IF NOT EXISTS testimonials (29    id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,30    name VARCHAR(100) NOT NULL,31    role VARCHAR(100) NOT NULL,32    content TEXT NOT NULL,33    image_url VARCHAR(255),34    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP35)";36 37$conn->query($sql);38?>39```