Create an Astrological Web Application with PHP and MySQL from Scratch

Rashmi Mishra
0

 



🔮 An Astrological Management System 
Using PHP and MySQL 

Project Overview:

Astrology has long been a source of curiosity and guidance for people. With the rise of digital transformation, astrologers and clients are increasingly looking for online platforms to manage consultations, horoscopes, and reports.

In this blog, we will learn how to build a complete Astrological Management System using PHP and MySQL, from planning to deployment.


🧰 Tools & Technologies Required

Before we start, make sure you have the following:

Tool

Purpose

XAMPP/WAMP

Local Server (Apache + MySQL + PHP)

VS Code / Sublime

Code Editor

phpMyAdmin

MySQL Database GUI

Browser

Chrome, Firefox, etc.

GitHub (optional)

For version control


🗂️ Project Objective

Our Astrological Management System will have the following modules:

1.   Admin Panel

o   Manage astrologers

o   Manage users

o   View appointment reports

o   Manage zodiac info and content

2.   User Panel

o   User registration/login

o   Book appointments with astrologers

o   View horoscope/zodiac info

o   Chatbox (optional)

3.   Astrologer Panel

o   View appointments

o   Add horoscope reports

o   Respond to users


✅ Step-by-Step Guide to Build the Project

Step 1: Setup Environment

  • Download and install XAMPP.
  • Place your project folder in:
    C:/xampp/htdocs/astrology_management_system_php
  • Start Apache and MySQL from the XAMPP control panel.

Step 2: Create the Database

Open http://localhost/phpmyadmin and create a new database:

CREATE DATABASE astrology_db;

Now create the following tables:

-- Users Table

CREATE TABLE users (

    id INT AUTO_INCREMENT PRIMARY KEY,

    name VARCHAR(100),

    email VARCHAR(100) UNIQUE,

    password VARCHAR(255),

    role ENUM('user', 'astrologer', 'admin'),

    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP

);

 

-- Appointments Table

CREATE TABLE appointments (

    id INT AUTO_INCREMENT PRIMARY KEY,

    user_id INT,

    astrologer_id INT,

    appointment_date DATE,

    status ENUM('pending', 'confirmed', 'completed') DEFAULT 'pending',

    report TEXT,

    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP

);

 

-- Zodiac Info Table

CREATE TABLE zodiac_info (

    id INT AUTO_INCREMENT PRIMARY KEY,

    zodiac_name VARCHAR(50),

    description TEXT,

    lucky_number VARCHAR(10),

    lucky_color VARCHAR(50)

);


Step 3: Setup Folder Structure

Your folder structure should look like:

astrology_management_system_php/

├── admin/

├── astrologer/

├── user/

├── includes/

   ├── db.php

   ├── header.php

   ├── footer.php

├── css/

├── js/

├── index.php

├── login.php

├── register.php

├── logout.php


Step 4: Database Connection (db.php)

<?php

$host = 'localhost';

$user = 'root';

$pass = '';

$db = 'astrology_db'; 

$conn = new mysqli($host, $user, $pass, $db); 

if ($conn->connect_error) {

    die("Connection failed: " . $conn->connect_error);

}

?>


Step 5: User Registration & Login

register.php

  • Collect user name, email, password
  • Insert into users table with role = 'user'

login.php

  • Authenticate based on role
  • Redirect to user/, admin/, or astrologer/ folder

Step 6: Admin Panel

Inside admin/ folder:

  • dashboard.php: Show overview
  • manage_users.php: CRUD on users
  • manage_astrologers.php: CRUD on astrologers
  • zodiac_info.php: Add or update zodiac descriptions

Step 7: User Panel

Inside user/ folder:

  • dashboard.php: Welcome page
  • book_appointment.php: Choose astrologer and date
  • my_appointments.php: View all appointments
  • view_zodiac.php: View zodiac information

Step 8: Astrologer Panel

Inside astrologer/ folder:

  • dashboard.php: View appointments
  • add_report.php: Add consultation report
  • appointment_history.php: Past appointments

Step 9: Appointment Booking Logic

In book_appointment.php:

if ($_SERVER['REQUEST_METHOD'] == 'POST') {

    $astrologer_id = $_POST['astrologer_id'];

    $appointment_date = $_POST['date'];

    $user_id = $_SESSION['user_id']; 

    $sql = "INSERT INTO appointments(user_id, astrologer_id, appointment_date)

            VALUES('$user_id', '$astrologer_id', '$appointment_date')";

    $conn->query($sql);

}


Step 10: Horoscope & Zodiac Module

Allow the admin to add zodiac signs and descriptions.

User Panel → View Zodiac Info:

$sql = "SELECT * FROM zodiac_info";

$result = $conn->query($sql);

 

while($row = $result->fetch_assoc()) {

    echo "<h3>{$row['zodiac_name']}</h3>";

    echo "<p>{$row['description']}</p>";

    echo "<p>Lucky Number: {$row['lucky_number']}</p>";

}


Step 11: Optional Features


🌐 Final Touch – Hosting & Deployment

  • Host your site on Hostinger, GoDaddy, or InfinityFree
  • Upload your MySQL DB via phpMyAdmin
  • Use FileZilla to upload PHP files
  • Update db.php with live DB credentials

📸 Sample Screenshots

(Insert screenshots of each panel: Admin, User, Astrologer)
























📦 Download Source Code

You can host your code on GitHub and provide a downloadable ZIP:

GitHub: https://github.com/lopalopa/astrology-management_system_php


📝 Conclusion

This Astrological Management System is a great beginner-to-intermediate level project for learning PHP CRUD operations, role-based access, and dynamic content generation.


Post a Comment

0Comments

Post a Comment (0)