Welcome Guest, Not a member yet? Register   Sign In
Call to undefined function CAST()
#1

(This post was last modified: 04-01-2019, 09:34 PM by Qiáo yī sī.)

Hi! Im having an error in using the cast function in my model. Does cast() works in codeigniter?

Here is my code.

   public function gen_report($personnel, $ym)
   {
       //print_r($personnel);exit();
       if($personnel != null){
           $query = $this->db->select('*')
               ->join('document_activity b', 'b.document_id = a.id')
               ->join('personnel c', 'c.id = b.receiver_personnel_id')
               ->join('document_type d', 'd.doctype_id = a.document_type_id')
                ->like('a.date_received', $ym)
                    ->CAST('a.tracking_no AS UNSIGNED')
                    ->order_by('date_received', 'ASC')
               ->where('b.receiver_personnel_id',$personnel)
               ->get('document a');
        }else{
            $query = $this->db->select('*')
            ->join('document_activity b', 'b.document_id = a.id')
            ->join('personnel c', 'c.id = b.receiver_personnel_id')
            ->join('document_type d', 'd.doctype_id = a.document_type_id')
            ->like('a.date_received', $ym)
                ->CAST('a.tracking_no AS UNSIGNED')
                ->order_by('date_received', 'ASC')
            ->get('document a');
        }
       
       if($query->num_rows() > 0){
           return $query->result();
       }else{
           return false;
       }
   }
Reply


Messages In This Thread
Call to undefined function CAST() - by Qiáo yī sī - 04-01-2019, 07:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB