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

class Voted_List_Model extends CI_Model
{
    function voted()
    {
      // $this->db->order_by("ballot_name", "asc");
     //  $query = $this->db->select('*')->from('ballot_status')->get(); 

$this->db->select('ballot_status.id,ballot_status.client_id,ballot_status.name,ballot_status.ballot_name,ballot_status.name,ballot_status.vote,ballot_status.vote_date_time,users.name as uname');
$this->db->from('users');
$this->db->join('ballot_status','ballot_status.client_id=users.cid');	
$query=$this->db->get();
//print_r($query->num_rows());die(); 
       
       if($query->num_rows()>0)
       {   
          return $query->result();
       }

       else
       {
           return false;
       }
    }

    function conditional_show($name)
    {
        $name=trim($name);
        $name=urldecode($name);

       $this->db->where('ballot_name',$name);
       $query = $this->db->get('ballot_status');
       $res= $query->result();

       if($query->num_rows()>0)
       {
            return $res;
       }

       else
       {
           return false;
       }
    }

}

?>
