How about, I'm inserting data and an image in Codeigniter by means of a form, all that works, but it sends me the following:
Severity: WarningMessage: Can not modify header information - headers already sent by (output started at /xxx/xxx/xxxx/xxxx/application/controllers/MController.php:78)
Filename: helpers / url_helper.php
Line Number: 564
Backtrace:
File: /xxx/xxxx/xxxxx/xxxx/application/models/MModel.php Line: 124 Function: redirect
File: /xxx/xxx/xxx/xxxx/application/controllers/MController.php Line: 94 Function: insert Test
The error you flag is in MController
on line 78
,
public function add(){
$config['upload_path'] = './imagenes/';
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config....
{
echo("<script>console.log('Error al subir la imagen');</script>");
$error = array('error' => $this->upload->display_errors());
}
else
{
echo("<script>console.log('Imagen subida correctamente');</script>");// <---Aquí marca error, línea 78
}
In MModel
the line that marks error is the 124
:
public function insertPrueba($data){
$this->db->insert(TABLE_PRODUCTO,$data);
redirect('MController');// Aquí marca el error
}
In index () of MController I load some data that I want to show and load static pages:
public function index()
{
$data['me'] = $this->MModel->getAll();
$data['mB'] = $this->MModel->getAllB();
$data['mP'] = $this->MModel->getAllP();
$data['cat'] = $this->MModel->getAllCat();
$this->load->view('estaticos/header');
$this->load->view('dinamicos/menu/menus', $data);
$this->load->view('estaticos/menu_izquierdo');
$this->load->view('estaticos/footer');
$this->load->view('estaticos/menu_derecho');
}
I do not know if I have anything to do with using redirect('MController');
...
I have reviewed these answers, but I do not have blank spaces starting <?php
or at the end ... or anything of the possible causes ..
How to fix "Headers already sent" error in PHP