Welcome Guest, Not a member yet? Register   Sign In
How to show error messages from models?
#2

[eluser]Alhazred[/eluser]
I add some code because it looks the problem is not sure to be inside the model, I've left only the constructor inside it and the problem persists.

Controller
Code:
class Authentication extends CI_Controller
{
/**
  * Funzione di login
  * @return boolean true in caso di successo, false altrimenti
  */
public function login()
{
  //form validation
  $this->load->library('form_validation');
  $this->form_validation->set_rules('username', 'lang:form_username', 'required|alpha_dash');
  $this->form_validation->set_rules('password', 'lang:form_password', 'required');
  
  //caricamento file messaggi autenticazione
  $this->lang->load('authentication_messages');

  if ($this->form_validation->run() == FALSE) //field validation failed
  {
   $data['message'] = lang('auth_login_validation_error');
   $this->load->view('authentication/login_form',$data);
  }
  else //fields ok
  {
   $username = $this->input->post('username',TRUE);
   $password = $this->input->post('password',TRUE);
  
   //load model, it is inside a subfolder, models/authentication/authentication.php
   //THE EXECUTION STOPS AT THIS LINE IF I REMOVE IT THE CONTROLLER GOES ON
   $this->load->model('authentication/Authentication');

   //$this->Authentication->init($username,$password); //inizializza l'oggetto
  
   $result = FALSE; // was $this->Autentication->login(); changed to debug
   if ( ! $result) //login failed
   {
    $data = array(); //reset dell'array $data
    $data['message'] = lang('auth_login_error');
    $this->load->view('authentication/login_form',$data);
   }
   else //login successful
   {
    $this->load->view('authentication/login_success');
   }
  }
}
}

Model
[code]
class Authentication extends CI_Model
{
function __construct()
{
parent::__construct();
}
}


Messages In This Thread
How to show error messages from models? - by El Forum - 07-08-2012, 01:32 AM
How to show error messages from models? - by El Forum - 07-08-2012, 02:11 AM
How to show error messages from models? - by El Forum - 07-08-2012, 03:35 AM
How to show error messages from models? - by El Forum - 07-08-2012, 10:55 AM
How to show error messages from models? - by El Forum - 07-08-2012, 01:06 PM
How to show error messages from models? - by El Forum - 07-08-2012, 01:51 PM



Theme © iAndrew 2016 - Forum software by © MyBB