prepare(" SELECT v.*, p.name as patient_name, p.dob, p.gender, d.name_en as doctor_name_en, d.name_ar as doctor_name_ar, d.specialization_en, d.specialization_ar FROM visits v JOIN patients p ON v.patient_id = p.id JOIN doctors d ON v.doctor_id = d.id WHERE v.id = ? "); $stmt->execute([$visit_id]); $visit = $stmt->fetch(); if (!$visit) { throw new Exception("Visit not found"); } // Fetch prescriptions // Check if table exists implicitly by try-catch $stmt = $db->prepare("SELECT * FROM visit_prescriptions WHERE visit_id = ?"); $stmt->execute([$visit_id]); $prescriptions = $stmt->fetchAll(); $lang = $_SESSION['lang'] ?? 'en'; } catch (Exception $e) { die("Error: " . $e->getMessage()); } ?> Prescription #<?php echo $visit_id; ?>

Hospital Management System

123 Medical Center Street, City, Country

Phone: +123 456 7890 | Email: info@hospital.com

Doctor:

Date:

Patient Name:
Age:
Gender:
Rx

No medications prescribed.

Dose:
Instr: