Advertisement
freddy0512

tanya

Apr 20th, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. //controller , yang ku tnyakan adalah $data['user'] = $this->user_model->getaktif();
  2. public function index()
  3. {
  4. if ($this->session->userdata('username')=="") {
  5. redirect('auth');
  6. }
  7. $data['username'] = $this->session->userdata('username');
  8. $data['user'] = $this->user_model->getaktif();
  9. $this->load->view('admin/welcome_message',$data);
  10.  
  11. }
  12.  
  13. //model
  14. function getaktif()
  15. {
  16. $username = $this->session->userdata('username');
  17. $this->db->where('username', $username);
  18. $this->db->select("*");
  19. $this->db->from("tabel_user");
  20. return $this->db->get();
  21. }
  22.  
  23.  
  24.  
  25. //view ini bagaimana ya jika gambar itu berisi
  26. <?php foreach($user->result() as $detail)
  27.  
  28. if( $detail['gambar']=='')
  29. {
  30. echo "gambar default";
  31. }
  32. else
  33.  
  34. {
  35. echo "dari database ambil"
  36.  
  37. }
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement