Advertisement
Guest User

CodeIgniter Error

a guest
Jun 8th, 2015
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.63 KB | None | 0 0
  1. contratos_model.php
  2.  
  3.    public function getById($id){
  4.  
  5.        
  6.         $this->db->where('idContrato',$id);
  7.         $this->db->limit(1);
  8.         $consulta = $this->db->get('contrato')->result();
  9.        
  10.  
  11.         foreach($consulta as &$valor){
  12.             $this->db->where('idCliente', $valor->idCliente);
  13.             $valor->curso = $this->db->get('cliente')->result();
  14.         }
  15.  
  16.         return $consulta;
  17.        
  18.     }
  19.  
  20.  
  21. contratos.php
  22.  
  23.     public function visualizar(){
  24.  
  25.         if(!$this->permission->checkPermission($this->session->userdata('permissao'),'vContrato')){
  26.            $this->session->set_flashdata('error','Você não tem permissão para visualizar Contratos.');
  27.            redirect(base_url());
  28.         }
  29.  
  30.         $this->data['custom_error'] = '';
  31.         $this->data['result'] = $this->contratos_model->getById($this->uri->segment(3));
  32.         $this->data['view'] = 'contratos/visualizar';
  33.         $this->load->view('tema/topo', $this->data);
  34.  
  35.     }
  36.  
  37. visualizar.php
  38.  
  39. <?
  40.     print_r($result);
  41. ?>
  42.  
  43.  
  44. ERRO:
  45.  
  46. Severity: Notice
  47. Message: Trying to get property of non-object
  48. Filename: contratos/visualizar.php
  49. Line Number: 37
  50.  
  51. RETORNO DO PRINT_R DO VISUALIZAR:
  52.  
  53. Array ( [0] => stdClass Object ( [idContrato] => 3 [idCliente] => 3 [idCedente] => 2 [forma_de_pagamento] => 96 [nota_fiscal] => 94 [fechamento_de] => 1 [fechamento_a] => 1 [vencimento] => 1 [guias] => 0 [status] => 0 [curso] => Array ( [0] => stdClass Object ( [idCliente] => 3 [razaosocial] => PIXX CRIATIVA SOLUCOES LTDA [nomefantasia] => PIXX CRIATIVA SOLUCOES LTDA [cnpj] => 0655544801120 [ie] => 0 [im] => 0 [endereco] => [endereco_numero] => 0 [endereco_complemento] => [endereco_bairro] => [endereco_cep] => 0 [endereco_cidade] => [endereco_estado] => 12 [responsavel] => André Baill [responsavel_telefone_ddd] => 41 [responsavel_telefone] => 96479364 [responsavel_celular_ddd] => 0 [responsavel_celular] => 0 [email] => [data_ativo] => 1970-01-01 [codCedente] => 4 [fat_endereco] => [fat_endereco_numero] => 0 [fat_endereco_complemento] => [fat_endereco_bairro] => [fat_endereco_cep] => 0 [fat_endereco_cidade] => [fat_endereco_estado] => 12 [fat_responsavel] => [fat_telefone_ddd] => 0 [fat_telefone] => 0 [fat_celular_ddd] => 0 [fat_celular] => 0 [email_financeiro] => [vencimento] => 1 [nota] => 94 [fechamento_de] => 1 [fechamento_a] => 1 [guias] => 0 [valor_moto_normal] => 0 [valor_moto_metropolitano] => 0 [valor_moto_depois_18] => 0 [valor_moto_km] => 0 [valor_carro_normal] => 0 [valor_carro_metropolitano] => 0 [valor_carro_depois_18] => 0 [valor_carro_km] => 0 [valor_caminhao_normal] => 0 [valor_caminhao_metropolitano] => 0 [valor_caminhao_depois_18] => 0 [valor_caminhao_km] => 0 [status] => 0 ) ) ) )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement