$this->dbforge->add_key('blog_id', TRUE);
$this->dbforge->add_key('site_id', TRUE);
// gives PRIMARY KEY `blog_id_site_id` (`blog_id`, `site_id`)
References :
model - Codeigniter MY_Model composite primary key - Stack Overflow
$this->dbforge->add_key('blog_id', TRUE);
$this->dbforge->add_key('site_id', TRUE);
// gives PRIMARY KEY `blog_id_site_id` (`blog_id`, `site_id`)
$orig_db_debug = $this->db->db_debug;
$this->db->db_debug = FALSE;
RUN QUERY HERE
$this->db->db_debug = $orig_db_debug;
$ vi system/core/input.php
if ( ! preg_match("/^[a-z0-9:_\/-|]+$/i", $str))
{
exit('Disallowed Key Characters.');
}
...
echo json_encode($myarray);
...
header("Content-type: application/json; charset=utf-8");
echo json_encode($myarray);
die;
Template::set_message('Your message displayed just fine.', 'success');
echo Template::message();
$message['type'] = 'success';View :
$message['message'] = 'Your message displayed just fine.';
Template::set('message', $message);
<div class="alert alert-block alert-{type} fade in notification"> <a data-dismiss="alert" class="close" href="#">×</a> <div>{message}</div> </div>
http://localhost:81/index.php/api/user/index/1
http://localhost:81/index.php/api/user/1
http://localhost:81/index.php/api/user
Route::any('api/(:any)/(:any)/(:num)', '$1/api/$2/$3');
Route::any('api/(:any)/(:num)', '$1/api/index/$2');
Route::any('api/(:any)/(:any)', '$1/api/$2');
Route::any('api/(:any)', '$1/api');
public function index($id = FALSE)
{
$return_data = array('user_id' => $id, 'status' => 'success', message' => '');
echo json_encode($return_data);
}
$this->load->model('person/person_model');
$this->load->helper('date');
$this->db->list_fields('table');
name="id[]" value="1"/> name="id[]" value="2"/> name="id[]" value="3"/>
$id = $this->input->post('id');
php echo $this->session->userdata('user_id'); ?>
$this->xxx_model->insert($data);
$this->db->insert_id();
$this->load->library("session"); // if you not load$this->session->set_userdata("SESSION_NAME","VALUE");echo $this->session->userdata("SESSION_NAME");
migrates$ vi application/config/config.php
$config['migrate.auto_core'] = TRUE; $config['migrate.auto_app'] = FALSE;