echo $project[0]['project_title']; ?>
Project details
Description
-
Project Type:
-
:




try { // Create (connect to) SQLite database in file $file_db = new PDO('sqlite:portfolio.db'); // Set errormode to exceptions $file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Get the project ID from the URL parameter $project_id = $_GET['id']; // SQL query to fetch projects and their associated images $sql = "SELECT p.id AS project_id, p.title AS project_title, p.summary AS project_summary, p.details AS project_details, p.category AS project_category, p.tags AS project_tags, pi.id AS image_id, pi.image_path AS image_path FROM projects p LEFT JOIN project_images pi ON p.id = pi.project_id AND (pi.deleted IS NULL OR pi.deleted != 1) WHERE p.id = :project_id"; // Prepare and execute the query $stmt = $file_db->prepare($sql); $stmt->bindParam(':project_id', $project_id, PDO::PARAM_INT); $stmt->execute(); // Fetch the results $project = $stmt->fetchAll(PDO::FETCH_ASSOC); if (empty($project)) { die('Sorry, project not found!'); } } catch (PDOException $e) { // If an error occurs, print it // echo $e->getMessage(); } ?>