how to create a waiting list for an appointment in php with codeigniter...any guide please

Recommended Answers

All 9 Replies

That's a little vague. Guide to using CI, or more info on your waiting list (which requires much more information), or both? CI tutorials are all over the web, searching does wonders.

I did search but to no avail..
What i want is if someone has cancel an appointment...and want to reschedule..
The secretary got to check a waiting list inorder to re-schedule it :/....

You can do it by creating a status column in your database; such that when an appointment is made, for instance; you can set the status to 1 for pending or 2 for completed or 3 for cancelled.

That should do the trick.

ohh..i have it....but wen its cancel , i want like a waiting list :(

Add a timestamp too, then you can query who cancelled first.

You can get better information if you try explaining your requirements in more than a single line.

Oki :)

Well what i want is..
A patient get registered ...
Now, the patient want to make an appointment . .
So appointment is created...
Now i want like if the patient want to cancel the appointment then reschedule..for some other day, and the patient gives a date..
Now the doctor got to check in waiting list if on that particular time/date ...theres no appointment..
My problem is how to do it..
Its with Php with Codeigniter+Mysql ..
Please help me out..
I already created the appointment Form..

*controller*

class Appointmenttest extends CI_Controller {

    public function __construct(){
        parent::__construct();
        $this->load->model('appointment_model');
    }

    public function index()
    {
        $this->appointment_model->setType('x_ray')
                                ->setDate(date('d-m-y'))
                                ->setTime(date('H:i:s'))
                                ->setPrice(250)
                                ->setStatus('Active')
                                ->setPatient(1)
                                ->setEmployee(1)
                                ->save();  // insert
        // select
        $this->appointment_model->findById(1);
        echo $this->appointment_model->getType();

        // update
        $this->appointment_model->setType('Blood_test')
                                ->setPrice(200)
                                ->save();

    }

}


*model*
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Appointment_model extends CI_Model
{
    private static $table='appointment';
    private $id;
    private $type;
    private $date;
    private $time;
    private $price;
    private $status;
    private $patient_id;
    private $employee_id;
    private $treatment_id;

    public function getId()
    {
        return $this->id;
    }

    private function setId($id)
    {
        $this->id=$id;
        return $this;
    }

    public function getType()
    {
        return $this->type;
    }

    public function setType($type)
    {
        $this->type=$type;

        return $this;
    }

    public function getDate()
    {
        return $this->date;
    }

    public function setDate($date)
    {
        $this->date=$date;

        return $this;
    }

    public function getTime()
    {
        return $this->time;
    }

    public function setTime($time)
    {
        $this->time=$time;

        return $this;
    }

    public function getPrice()
    {
        return $this->price;
    }

    public function setPrice($price)
    {
        $this->price=$price;

        return $this;
    }

    public function getStatus()
    {
        return $this->status;
    }

    public function setStatus($status)
    {
        $this->status=$status;

        return $this;
    }

    public function getPatient()
    {
        return $this->patient_id;
    }

    public function setPatient($id)
    {
        $this->patient_id=$id;

        return $this;
    }

    public function getEmployee()
    {
        return $this->employee_id;
    }

    public function setEmployee($id)
    {
        $this->employee_id=$id;

        return $this;
    }



    public function save()
    {
        $data=array(
                'type'=>$this->getType(),
                'date'=>$this->getDate(),
                'time'=>$this->getTime(),
                'price'=>$this->getPrice(),
                'status'=>$this->getStatus(),
                'P_ID'=>$this->getPatient(),
                'E_ID'=>$this->getEmployee(),

            );
        if ($this->getId()) {
            //update
            $this->db->where('Appointment_ID', $this->getId());
            $this->db->update(self::$table, $data);
        } else {
            //insert
            $this->db->insert(self::$table,$data);
        }
    }

    public function findById($id)
    {
        $query=$this->db->get_where(self::$table, array('Appointment_ID' => $id));

        $result=$query->result();
        if(!$result){
            return false;
        }
        $result=$result[0];
        $this->setId($result->Appointment_ID)
             ->setType($result->Type)
             ->setDate($result->Date)
             ->setTime($result->Time)
             ->setPrice($result->Price)
             ->setStatus($result->Status)
             ->setPatient($result->P_ID)
             ->setEmployee($result->E_ID)


        return $this;
    }

    public function findAll()
    {
        $query=$this->db->get(self::$table);

        return $query->result();
    }
}

I want create a waiting list for students who have registered for school and are waiting to be placed.
There should be a waiting list, maybe for 1-30 students and from that list i manage to place only 10.
If I managed to place 1-10 that means am left 20, after that i want that student who was number 11 now to be number 1 because the first 10 have gone.

I hope you understand what am trying to say.

Thank you in advance.

Member Avatar for diafol

Start your own thread if not directly related to the OP.

However, you just have a flag field (as noted above) for 'waiting', 'placed' (or 0,1) and a timestamp or datetime for when the student made the application. Simple.

SELECT * FROM `students` WHERE `status` = 0 ORDER BY  `app_time` LIMIT 20
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.