Welcome Guest, Not a member yet? Register   Sign In
need a clarification
#1

I am having one input item

when i submit the button two action should be taken

condition 
1, check with table1 if users already registered ,display the error message 'already Registered';
2, check with table2 if data available means Display the (name,phone) to the another screen else
    return error message 'Data not available';
I need clarity of my post. 

Controller
      $this->load->helper('url_helper');
          $this->load->library('form_validation');
          $regno = $this->input->post('regno');
          //echo $regno;
          $this->load->model('user_model');
          $result=$this->User_Model->check_alt_exists($regno);

          print_r($result);
          if($result>=1)
          {
          $this->load->library('session'); 
                $this->load->helper('url'); 

          $data['title'] = 'Registration';
          $this->session->set_flashdata('user_loggedin', 'Already Registered');
redirect('users/register1','refresh');
          $this->load->view('templates/header');
          //$this->load->view('users/register1',$data);
      $this->load->view('templates/footer');
          }
          else
          {
      echo "hai";
            } 


Model
****


public function check_alt_exists($regno){
$this->db->select('*');
  $this->db->from('users');
  $this->db->where('username',$regno);
  $query=$this->db->get();
 
  if($query->num_rows()>0){
    return true;
  }else{
    return false;
  }
}

I am struggled how to set 3 condition in one controller or written in another function should be called in this controller . Is it a good way..
Reply


Messages In This Thread
need a clarification - by kvanaraj - 09-07-2018, 06:20 AM
RE: need a clarification - by Wouter60 - 09-07-2018, 07:17 AM
RE: need a clarification - by kvanaraj - 09-07-2018, 11:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB