1
votes

my validations are working ok but after that userid and password results empty in model fit_reg_model and it results into authentication failed.please help me out. this is my code :

model fit_reg_model `

class Ftg_reg_model extends CI_Model {

public function log_valid( $userid, $password )
{

    $this->db->select("regID,loginCode");
    $whereCondition = $array = array('regID' =>$userid,'loginCode'=>$password);
    $this->db->where($whereCondition);
    $this->db->from('fit_1login');
    $query = $this->db->get();
    ////////////////////////////////checking values////////////////////
    echo"<pre>";
               print_r ($query->result()); exit;
               return $query->row()->countID;




     if( $query->num_rows() )
           {

            echo"<pre>";
               print_r ($query->result()); exit;
               return $query->row()->countID;
               //return TRUE;
           }
             else
           {
               return FALSE;
           }
}

} contrller fit_ci ` public function fit_loguser() { $this->load->library('form_validation'); $this->form_validation->set_rules('uname','User Id','required|valid_email|valid_emails|trim'); $this->form_validation->set_rules('password','Password','required|trim'); $this->form_validation->set_error_delimiters("","

");
    if($this->form_validation->run() )
    {
        $userid = $this->input->post('uname');
        $password = $this->input->post('password');

        //////////////////////////////////////loding model////////////////
        $this->load->model('ftg_reg_model');

         //echo $userid , $password;

        if( $this->ftg_reg_model->log_valid('$userid','$password')== True )
        {
          //$this->load->view('fitasy/fit_userprofile'); 
            $this->load->library('session');
            $this->session->set_userdata('id',$id);
            echo "Successful loged";

        }
        else
        {
         echo "Authentication failed";
        }
    }
    else
    {
      $data['title'] = 'Fit';
        $this->load->helper('form');
        $this->load->view('fit/index.php',$data);


    }
}

`

view fit_loguser ` Login here to add items to your Cart 'form-horizontal'])?>

           <?php echo form_error('uname'); ?>
           <?php echo form_input(['name'=>'uname','class'=>'form-control','placeholder'=>'Username','value'=>set_value('uname')])?><br>

           <?php echo form_error('password'); ?>
           <?php echo form_password(['name'=>'password','class'=>'form-control','placeholder'=>'Password'])?><br>

           <?php echo form_submit(['name'=>'logsubmit','class'=>'btn btn-default','value'=>'Proceed','type'=>'submit'])?>

    <?php echo form_close()?><!-------------form close-------------------------------------->

</div>`
1
Please format your question. - Ekta Padaliya
ok i will , new to stakoverflow - shilpa
That's why telling you. - Ekta Padaliya
where to edit or i have to post it again? - shilpa
Edit option is there below the question tag. Got? - Ekta Padaliya

1 Answers

0
votes

Try to remove

$this->db->select("regID,loginCode");

In your model to see what's happening