Created
May 5, 2017 02:30
-
-
Save cikal/059a28a69cc64747a8122244a6c62bf5 to your computer and use it in GitHub Desktop.
for : Muhammad Abu Bakar As'sidiq (Group CI - Indo)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* ------------------------------------------------------------------------ | |
* File Controller | |
*/ ------------------------------------------------------------------------ | |
defined('BASEPATH') OR exit('No direct script access allowed'); | |
class Coba extends CI_Controller { | |
public function __construct() | |
{ | |
parent::__construct(); | |
$this->load->model('m_coba'); | |
} | |
public function index() | |
{ | |
$data['query'] = $this->m_coba->get_all(); | |
$this->load->view('v_coba', $data); | |
} | |
} | |
/* End of file Coba.php */ | |
/* Location: ./application/controllers/Coba.php */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* ------------------------------------------------------------------------ | |
* File Model | |
*/ ------------------------------------------------------------------------ | |
defined('BASEPATH') OR exit('No direct script access allowed'); | |
class M_coba extends CI_Model { | |
function get_all() { | |
return $this->db->get('tb_nama'); | |
} | |
} | |
/* End of file M_coba.php */ | |
/* Location: ./application/models/M_coba.php */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ------------------------------------------------------------------------ | |
* File SQL | |
*/ ------------------------------------------------------------------------ | |
CREATE TABLE `tb_nama` ( | |
`id` INTEGER PRIMARY KEY AUTOINCREMENT, | |
`nama` TEXT | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* ------------------------------------------------------------------------ | |
* File View | |
*/ ------------------------------------------------------------------------ | |
$rs = array(); | |
foreach ($query->result() as $t) { | |
$rs[] = $t; | |
} | |
$json = json_encode($rs); | |
print $json; | |
/* End of file v_coba.php */ | |
/* Location: ./application/views/v_coba.php */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment