A
Anonymous

Directory Structure - Copy this React, Tailwind Component to your project

Cấu trúc thư mục plaintext Sao chép mã hospital management/ │ ├── index.php ├── css/ │ └── style.css ├── includes/ │ ├── header.php │ └── footer.php ├── pages/ │ ├── doctors.php │ └── patients.php ├── db/ │ └── db.php └── assets/ └── images/ 1. Tệp index.php Tệp này sẽ là trang chủ của ứng dụng quản lý bệnh viện, hiển thị các liên kết đến trang quản lý bác sĩ và bệnh nhân. php Sao chép mã <?php include 'includes/header.php'; ?> <div class="container"> <h1>Welcome to Hospital Management System</h1> <div class="links"> <a href="pages/doctors.php">Manage Doctors</a> <a href="pages/patients.php">Manage Patients</a> </div> </div> <?php include 'includes/footer.php'; ?> 2. Tệp includes/header.php Đây là phần đầu trang, chứa thẻ <head>, liên kết đến các tệp CSS, và thanh điều hướng. php Sao chép mã <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF 8"> <meta name="viewport" content="width=device width, initial scale=1.0"> <title>Hospital Management</title> <link rel="stylesheet" href="../css/style.css"> </head> <body> <nav> <ul> <li><a href="../index.php">Home</a></li> <li><a href="doctors.php">Doctors</a></li> <li><a href="patients.php">Patients</a></li> </ul> </nav> 3. Tệp includes/footer.php Phần này chứa nội dung cuối trang (footer). php Sao chép mã <footer> <p>&copy; 2024 Hospital Management System</p> </footer> </body> </html> 4. Tệp css/style.css Đây là tệp CSS để định dạng giao diện. css Sao chép mã body { font family: Arial, sans serif; background color: #f4f4f4; margin: 0; padding: 0; } nav { background color: #333; padding: 10px; } nav ul { list style type: none; margin: 0; padding: 0; } nav ul li { display: inline; margin right: 20px; } nav ul li a { color: white; text decoration: none; } .container { padding: 20px; } .links a { display: inline block; margin: 10px; padding: 10px 20px; background color: #28a745; color: white; text decoration: none; border radius: 5px; } footer { background color: #333; color: white; text align: center; padding: 10px 0; position: fixed; width: 100%; bottom: 0; } 5. Tệp db/db.php Tệp này quản lý kết nối đến cơ sở dữ liệu MySQL. php Sao chép mã <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "hospital_db"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn >connect_error) { die("Connection failed: " . $conn >connect_error); } ?> 6. Tệp pages/doctors.php Trang này hiển thị danh sách các bác sĩ. Dữ liệu sẽ được lấy từ cơ sở dữ liệu. php Sao chép mã <?php include '../includes/header.php'; include '../db/db.php'; $sql = "SELECT * FROM doctors"; $result = $conn >query($sql); ?> <div class="container"> <h2>Doctors List</h2> <table> <tr> <th>ID</th> <th>Name</th> <th>Specialization</th> </tr> <?php while($row = $result >fetch_assoc()): ?> <tr> <td><?php echo $row['id']; ?></td> <td><?php echo $row['name']; ?></td> <td><?php echo $row['specialization']; ?></td> </tr> <?php endwhile; ?> </table> </div> <?php include '../includes/footer.php'; ?> 7. Tệp pages/patients.php Tương tự như doctors.php, nhưng dành cho quản lý bệnh nhân. php Sao chép mã <?php include '../includes/header.php'; include '../db/db.php'; $sql = "SELECT * FROM patients"; $result = $conn >query($sql); ?> <div class="container"> <h2>Patients List</h2> <table> <tr> <th>ID</th> <th>Name</th> <th>Age</th> <th>Disease</th> </tr> <?php while($row = $result >fetch_assoc()): ?> <tr> <td><?php echo $row['id']; ?></td> <td><?php echo $row['name']; ?></td> <td><?php echo $row['age']; ?></td> <td><?php echo $row['disease']; ?></td> </tr> <?php endwhile; ?> </table> </div> <?php include '../includes/footer.php'; ?> 8. Tạo bảng MySQL Dưới đây là các truy vấn SQL để tạo bảng bác sĩ và bệnh nhân. sql Sao chép mã CREATE DATABASE hospital_db; USE hospital_db; CREATE TABLE doctors ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, specialization VARCHAR(100) NOT NULL ); CREATE TABLE patients ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100) NOT NULL, age INT NOT NULL, disease VARCHAR(100) NOT NULL );

Prompt
Component Preview

About

DirectoryStructure - Organize your hospital management files seamlessly with easy navigation, PHP integration, and responsive design,. Download instantly!

Share

Last updated 1 month ago