Tried following code for API using CI API tutorial
http://code.tutsplus.com/tutorials/working-with-restful-services-in-codeigniter--net-8814 , but the error says "Fatal error: Call to undefined function find_one() in /Applications/XAMPP/xamppfiles/htdocs/cms/fuel/application/controllers/api.php on line 10" , how can i solve this? i guess the model is not loaded correctly.
<?php
require(APPPATH.'/libraries/REST.php');
class Api extends REST{
function user_get(){
if(!$this->get('id')) $this->response(NULL, 400);
$this->load->module_model(FUEL_FOLDER, 'fuel_users_model');
$user=$this->fuel_users_model>find_one(array('id'=>$this->get('id')));
print_r($user);
exit;
if($user){
$this->response($user,200);
}else{
$this->response(NULL,404);
}
}
}
Comments
$CI =& get_instance(); $CI->load->module_model(FUEL_FOLDER, 'fuel_users_model'); $user=$CI->fuel_users_model->find_one(array('id'=>$this->get('id')));
hmm, still same error