![]() |
how to display data to the view? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: how to display data to the view? (/showthread.php?tid=19282) Pages:
1
2
|
how to display data to the view? - El Forum - 06-03-2009 [eluser]yudahebat[/eluser] I have a model like this Code: class Crud extends Model and controller like this Code: function cetak_data() and my view like this Code: <h1 style="color:#E7541A;">Data User</h1> but its didn't show the data on $pesan just become array on the view not the data that ive choose... what wrong? help please... how to display data to the view? - El Forum - 06-03-2009 [eluser]Thorpe Obazee[/eluser] [quote author="yudahebat" date="1244032293"]I have a model like this Code: class Crud extends Model and controller like this Code: function cetak_data() and my view like this Code: <h1 style="color:#E7541A;">Data User</h1> but its didn't show the data on $pesan just become array on the view not the data that ive choose... what wrong? help please...[/quote] You're passing an array. Try $pesan['id'], $pesan['id_user']. how to display data to the view? - El Forum - 06-03-2009 [eluser]yudahebat[/eluser] it works, but all data display. not data that I choose.. anything wrong? how to display data to the view? - El Forum - 06-03-2009 [eluser]Thorpe Obazee[/eluser] what is now the current code? this one or the other one in the other post? how to display data to the view? - El Forum - 06-03-2009 [eluser]yudahebat[/eluser] same like above.. just change $pesan into $pesan['id'],$pesan['id_user']etc. like your command how to display data to the view? - El Forum - 06-03-2009 [eluser]Thorpe Obazee[/eluser] I suggest you just return the result from the model and pass it to the view [quote author="yudahebat" date="1244032293"]I have a model like this Code: class Crud extends Model and controller like this Code: function cetak_data() and my view like this Code: <h1 style="color:#E7541A;">Data User</h1> but its didn't show the data on $pesan just become array on the view not the data that ive choose... what wrong? help please...[/quote] look above. What you did is that you overwritten your $data variable over and over which gives you just one row. Then you didn't loop through your array so you got 'Array' as an output. how to display data to the view? - El Forum - 06-03-2009 [eluser]sl3dg3hamm3r[/eluser] By the way, your sql-query is open for any random sql-injection... how to display data to the view? - El Forum - 06-03-2009 [eluser]yudahebat[/eluser] I suspend on this code Code: $this->db->query('SELECT * FROM reservasi WHERE tgl_pesan BETWEEN '. $this->input->post('dari_tgl'). because the data that I choose didn't show but all data show.. do you know whats wrong? how to display data to the view? - El Forum - 06-03-2009 [eluser]qirk petrucci[/eluser] so you already did like bargainph said ? and now the view is ok except it shows all data in your table? what do u have in the $_post ? maybe u could debug it by : Code: echo 'SELECT * FROM reservasi WHERE tgl_pesan BETWEEN '. $this->input->post('dari_tgl'). ' AND '.$this->input->post('sampai_tgl').'' and see if there's a query error how to display data to the view? - El Forum - 06-03-2009 [eluser]yudahebat[/eluser] yes, I've already did like bargainph said.. and it show all data from my table on my $_post I've an input form which is get date from popup javascript calendar I want to choose data from the table where the date is between $_post1 and $_post2 so it show data that I choose. from X date until X date do understand what I mean? |