Welcome Guest, Not a member yet? Register   Sign In
Message: Array to string conversion
#1

[eluser]Unknown[/eluser]
BEFORE SEE THE PRINT <-

what could this be?

add method in my controller
Code:
function cadastrar()
    {
        $this->load->library('form_validation');
        
        $validacoes = array(
            array('field' => 'titulo', 'label' => 'Título', 'rules' => 'required|min_lenght[10]|max_lenght[200]'),
            array('field' => 'texto', 'label' => 'Texto', 'rules' => 'required|min_lenght[20]')
        );
        $this->form_validation->set_rules($validacoes);
        
        if($this->form_validation->run() == FALSE)
        {
            $this->index();
        }
        else
        {
            $config['upload_path'] = 'images/noticias';
            $config['allowed_types'] = 'gif|jpg|png';
            $config['max_size'] = 0;
            $config['max_width'] = 0;
            $config['max_height'] = 0;
            $config['encrypt_name'] = TRUE;
            
            $this->load->library('upload',$config);
            if(!$this->upload->do_upload())
            {
                echo $this->upload->display_errors();
            }
            else
            {
                $arquivo_enviado = $this->upload->data();
                
                $data = date('Y-m-d');
                
                //$this->dados['data'] = $data;
                //$this->dados['autor'] =  'admin';
                $this->dados['titulo'] = $this->input->post('titulo');
                $this->dados['texto'] = $this->input->post('texto');
                $this->dados['imagem'] = $arquivo_enviado['file_name'];
                $this->dados['fonte'] = $this->input->post('fonte');
                
                $this->load->model('admin/noticias_model');
                
                if($this->noticias_model->cadastrar($this->dados))
                {
                    $this->index();
                }
                else
                {
                    echo 'Erro ao cadastrar notícia';
                }
            }
        }
    }




Theme © iAndrew 2016 - Forum software by © MyBB