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

class Delete_Vote_Data_Model extends CI_Model
{
    
    function Delete_Ballot($ballot_id)
    {   
        $ballot_id=urldecode($ballot_id);
        $ballot_id=trim($ballot_id);
        $this -> db -> where('id', $ballot_id);
        $this -> db -> delete('ballot');
       // $query=$this->db->query("update user_details SET '$edit_data' where username='$username' ");

       if($this->db->affected_rows()>0)
       {     
             return true;
       }

       else
       {
           return false;
       }
    }

    function Delete_Candidate($pid)
    {   
        $pid=urldecode($pid);
        $pid=trim($pid);
        $this -> db -> where('pid', $pid);
        $this -> db -> delete('participants');
       // $query=$this->db->query("update user_details SET '$edit_data' where username='$username' ");

       if($this->db->affected_rows()>0)
       {     
            return true;
       }

       else
       {
           return false;
       }
    }

    function Delete_Ballot_Status($ballot_name)
    {   
        $ballot_name=urldecode($ballot_name);
        $ballot_name=trim($ballot_name);
        $this -> db -> where('ballot_name', $ballot_name);
        $this -> db -> delete('ballot_status');
       // $query=$this->db->query("update user_details SET '$edit_data' where username='$username' ");

       if($this->db->affected_rows()>0)
       {           
            $this -> db -> where('ballot_name', $ballot_name);
            $this -> db -> delete('participants');

            if($this->db->affected_rows()>0)
            {
                return true;
            }
            else
            {
                return true;
            }
       }

       else
       {
           return false;
       }
    }


}

?>
