Odd flash issue for me... - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Odd flash issue for me... (/showthread.php?tid=9755) |
Odd flash issue for me... - El Forum - 07-07-2008 [eluser]internut[/eluser] Ok I'm going nuts hours later I have to post. This is working fine: Code: $this->session->set_flashdata('sys_message', 'User Updated'); Its showing up when redirected to: /users/page/ If I uncomment out the line above, and comment out the redirect to /users/page/ it will not display the flash data msg. Why? I'm going nutso Why is /users/page/ finding the flash fine and /users/edit/1/ for example not? Odd flash issue for me... - El Forum - 07-08-2008 [eluser]flojon[/eluser] You've probably missed calling Code: $this->session->flashdata('sys_message'); Odd flash issue for me... - El Forum - 07-08-2008 [eluser]internut[/eluser] I do have it and I'm getting strange behavior. In: /users/save/ I have: Code: $this->session->set_flashdata('sys_message', 'User Updated'); Then in: /users/edit/ function I have: Code: $query = $this->db->query("SELECT * FROM users WHERE id='$id'"); And its producing this error: Fatal error: Cannot use object of type stdClass as array in C:\Program Files\WebServer\Abyss Web Server\htdocs\php\NEW\admin\system\application\controllers\users.php on line 217 If I move: Code: $this->load->view('users_edit',$data); hmm now I notice it prolly has something to do with the $data array... Should i set that var in $data[] differently? Odd flash issue for me... - El Forum - 07-08-2008 [eluser]flojon[/eluser] [quote author="internut" date="1215551631"] Code: $data[sys_message] = $this->session->flashdata('sys_message'); // set system message to hmm now I notice it prolly has something to do with the $data array... Should i set that var in $data[] differently?[/quote] You've made a typo, change the line above to this: Code: $data['sys_message'] = .. Odd flash issue for me... - El Forum - 07-08-2008 [eluser]Pascal Kriete[/eluser] It is the data array. Code: $data = $query->row(); Assigns an object to $data, you're then trying to add a key. Solution(s): Code: $data['row'] = $query->row(); Odd flash issue for me... - El Forum - 07-08-2008 [eluser]internut[/eluser] You guys rock. Code: $data->sys_message = $this->session->flashdata('sys_message'); Did not seem to work but this does: Code: $id = $this->uri->segment(3); // Get user ID Thanks a ton fellas. |