Advertisement
freddy0512

fungsi cari

Jul 13th, 2015
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. /*---------controller----*/
  2. public function cari_renungan()
  3. {
  4. $q=$this->input->post('q');
  5. $data['cari'] = $this->renungan_model->cari($q);
  6. $this->load->view('cari_renungan',$data);
  7. }
  8.  
  9.  
  10. /*---------model----*/
  11. function cari()
  12. {
  13. $q = $this->input->POST ('q');
  14. return $this->db->query("SELECT * FROM
  15. artikel a, rtulis b, rkater c
  16. where a.rt_id=b.rt_id and
  17. a.rk_id=c.rk_id and a.ar_section='RENUNGAN'
  18. and (a.ar_title
  19. like '%$q%' or b.rt_name like '%$q%' )
  20. group by a.ar_id");
  21. }
  22.  
  23.  
  24. /*---------view------*/
  25.  
  26. <?php foreach ($cari->result() as $row)
  27. { ?>
  28. <h2><?php echo $row->ar_title ?></h2>
  29.  
  30. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement