Advertisement
citstudio

Auto Complete Part - 2

Nov 8th, 2014
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. <?php
  2. class controllerku extends CI_Controller {
  3. public function autocomplete(){
  4. $this->load->model('modvsiswa');
  5. $q = $_REQUEST['term'];
  6. $cn = new modvsiswa();
  7. $data = $cn->siswaPerpusUnregister($q);
  8. $count = count($data);
  9. $jumlah = 0;
  10. $jumlah = ($count > 0 ? '' : '');
  11. $response = array();
  12. foreach ($data as $val => $r){
  13. array_push($response, array("id"=>$r['nis'],"label"=>$r['nis']." = ".$r['nama'],"value"=>$r['nis']));
  14. }
  15. echo json_encode($response);
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement