[eluser]Unknown[/eluser]
I have this code that will affect one field in a database, however its not working for some reason and I don't see my error, please, I need help:
controller
Code:
class noticias extends CI_controller
{
public function __construct()
{
parent::__construct();
$this->load->model('noticia_model');
$this->load->helper('url');
$this->load->library('session');
}
public function deactivatenoticia()
{
$id=$_GET['id'];
$ini=$_GET['fechaini'];
$fin=$_GET['fechafin'];
if($this->session->userdata('user_level') != null)
{
$this->noticia_model->ocultarNoticia($id);
$str = '/noticias/search?fechaini='.$ini.'&fechafin;='.$fin;
echo $str;
redirect('/noticias/search');
}
else
{
redirect('/loginc/initlogin/');
}
}
}
and the method in the model is:
Code:
function ocultarNoticia($id)
{
$this->load->database();
$query=$this->db->query("Update noticias set not_visible=1 where id_noticia = $id");
}
the proble is that the application is not responding, since I also tried commenting the if, and it still doesn't do the code inside, as if I had never written the code (I even tried to enter sintax error in the model and it didn't recognize it).