this is my code ive been using
<?php
require(APPPATH.'libraries/REST_Controller.php');
class Test extends REST_Controller {
function simpletest_get() {
$data->name = 'HELLO';
$data->university = 'coventry';
$this->response($data, 200);
}
function film_get() {
$this->load->database();
$sql = 'SELECT * FROM films;';
$query = $this->db->query($sql);
$data = $query->result();
$this->response($data, 200);
}
function films_get($film_id) {
$this->load->database();
$sql = 'SELECT * FROM films WHERE code = "'.$films_id.'";';
$query = $this->db->query($sql);
$data = $query->row();
$this->response($data, 200);
}
}