0
votes

Unable to locate the model you have specified: User_model Filename: /opt/lampp/htdocs/ci/system/core/Loader.php

Line Number: 348

Backtrace:

File: /opt/lampp/htdocs/ci/index.php Line: 315 Function: require_once

i tried to change name but it dose not work.... this code model

db->where(array( 'username' => $username, 'password' => $password )); $result = $this->db->get('users'); if($result->num_rows()==1 ){ $return->$result->row(0)->id; }else { return false ; } } } ?>
1

1 Answers

0
votes

Make sure in model folder, the file name starts with Capital and very important point is "Change the model name to some "Reg_model.php" etc and update the controllers file accordingly.. This will surely works !!!

In controllers also use capital letter for the file name

NOTE: dont use the file names like Register_model.php etc , Instead use Reg_model.php

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {
   
     function __construct()
      {
        parent::__construct();
      }
 
            
                
	public function index()
	{
		$this->register();
	  }
  
         public function register()
          
	  $json = json_decode(file_get_contents('php://input'), TRUE); 
            $name= $json['name'];
            $email = $json['email'];
            $password = $json['password'];  

         echo $name;   echo $email;    echo $password; 
           $this->load->model('Reg_model');
         $red=  $this->Reg_model->registeration($name,$email,$password); 
         // echo 'controller23'; die();
          $insert_id = $this->db->insert_id(); 
          if($insert_id!==""){

        $sql = "SELECT * FROM `users` where uid='$insert_id'";
        $query = $this->db->query($sql);
        $array1 = $query -> row();
          echo  json_encode($array1);}else{} }

public function  login(){
      $json = json_decode(file_get_contents('php://input'), TRUE);
     $password =   $json['password']; 
     $email =   $json['email'];
    $resp= $this->db->get_where('users', array('email'=>$email, 'password'=>$password))->row();
     if($resp==""){  echo 'incorrect email or password'; }else
         {
          echo 'login success';
          echo  json_encode($resp);
         
     }
}		 
}