array session didn't work |
[eluser]yudahebat[/eluser]
I have a controller Code: function v_cart() and view Code: <?php echo form_open('mrputucar/update_cart'); ?> when I run it, the array didn't work its error Code: A PHP Error was encountered Code: A PHP Error was encountered Code: Fatal error: Call to a member function result_array() on a non-object in C:\xampp\htdocs\CI2\system\application\views\v_cart.php on line 23 line 23 : Code: $user_array = $query->result_array(); whats wrong? I just wanna show my session on array. so every I input data from another views it will show as a session without replace last entry data looks like cart system...
[eluser]Thorpe Obazee[/eluser]
why not continue this post? http://ellislab.com/forums/viewthread/120290/
[eluser]Thorpe Obazee[/eluser]
Do you know when to use result_array()? Do you know how to use $this->session->userdata()?
[eluser]yudahebat[/eluser]
I'm new on CI. I dont know how to use both off them very much. I just know little bit bout $this->session->userdata()? from the user guide. its use to get session data teach me more please. how to use it on array...
[eluser]Thorpe Obazee[/eluser]
From the error, it says that you need to put a parameter in $this->session->userdata(); PS. You'll need to modify the controller that you store arrays in the sessions and loop through it. I suggest you work with the controller first that it actually does what you need it to do. I suggest you look at how the Cart class works.
[eluser]yudahebat[/eluser]
i've do what you command and its error Code: Fatal error: Call to a member function result_array() on a non-object in C:\xampp\htdocs\CI2\system\application\views\v_cart.php on line 23 Code: $user_array = $query->result_array();
[eluser]Thorpe Obazee[/eluser]
[quote author="bargainph" date="1245306654"]Do you know when to use result_array()? Do you know how to use $this->session->userdata()?[/quote] 1. Please refer to my previous post about how you are storing session data in the method of your controller. hint: look at your controller. hint 2: multidimensional array. [quote author="yudahebat" date="1245306448"] Code: $this->session->set_userdata(array('nama' => $this->input->post('nama'),'photo' => $this->input->post('photo'),'harga' => $this->input->post('harga'),'renttgl' => $this->input->post('renttgl'),'rettgl' => $this->input->post('rettgl'))); 2. A very good example of how this works is the Cart class(Why don't you try to use that? Please don't ONLY copy and paste code.). 3. Have you looked into the link I posted above about result_array()?
|
Welcome Guest, Not a member yet? Register Sign In |