0% found this document useful (0 votes)
3 views3 pages

New Text Document

The document outlines the creation of a Zoo Management System using HTML, CSS, PHP, and MySQL. It includes a database schema with tables for animals, employees, and visitors, along with PHP code for database connection and data retrieval. Additionally, it provides HTML structure for displaying the data in tables and basic CSS for styling the layout.

Uploaded by

m4264929
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

New Text Document

The document outlines the creation of a Zoo Management System using HTML, CSS, PHP, and MySQL. It includes a database schema with tables for animals, employees, and visitors, along with PHP code for database connection and data retrieval. Additionally, it provides HTML structure for displaying the data in tables and basic CSS for styling the layout.

Uploaded by

m4264929
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Here is a basic source code for a Zoo Management System project using HTML, CSS,

PHP, and MySQL:

# Database Schema
Create a new database in MySQL called zoo_management and add the following tables:

CREATE TABLE animals (


animal_id INT PRIMARY KEY,
name VARCHAR(255),
species VARCHAR(255),
age INT
);

CREATE TABLE employees (


employee_id INT PRIMARY KEY,
name VARCHAR(255),
position VARCHAR(255)
);

CREATE TABLE visitors (


visitor_id INT PRIMARY KEY,
name VARCHAR(255),
date_visited DATE
);

# PHP Code
Create a new file called db.php and add the following code:

<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "zoo_management";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
?>

Create a new file called index.php and add the following code:

<?php
include 'db.php';

// Retrieve data from database


$animals = $conn->query("SELECT * FROM animals");
$employees = $conn->query("SELECT * FROM employees");
$visitors = $conn->query("SELECT * FROM visitors");

// Display data
?>

<!DOCTYPE html>
<html>
<head>
<title>Zoo Management System</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
<h1>Zoo Management System</h1>
<h2>Animals</h2>
<table>
<tr>
<th>Animal ID</th>
<th>Name</th>
<th>Species</th>
<th>Age</th>
</tr>
<?php while($row = $animals->fetch_assoc()) { ?>
<tr>
<td><?php echo $row['animal_id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['species']; ?></td>
<td><?php echo $row['age']; ?></td>
</tr>
<?php } ?>
</table>

<h2>Employees</h2>
<table>
<tr>
<th>Employee ID</th>
<th>Name</th>
<th>Position</th>
</tr>
<?php while($row = $employees->fetch_assoc()) { ?>
<tr>
<td><?php echo $row['employee_id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['position']; ?></td>
</tr>
<?php } ?>
</table>

<h2>Visitors</h2>
<table>
<tr>
<th>Visitor ID</th>
<th>Name</th>
<th>Date Visited</th>
</tr>
<?php while($row = $visitors->fetch_assoc()) { ?>
<tr>
<td><?php echo $row['visitor_id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['date_visited']; ?></td>
</tr>
<?php } ?>
</table>
</body>
</html>

# CSS Code
Create a new file called styles.css and add the following code:

body {
font-family: Arial, sans-serif;
}

table {
border-collapse: collapse;
width: 100%;
}

th, td {
border: 1px solid #ddd;
padding: 10px;
text-align: left;
}

th {
background-color: #f0f0f0;
}

This is a basic example to get you started. You can add more features, styles, and
functionality as needed.

You might also like