[SOLVED] set_flashdata in Model? - 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: [SOLVED] set_flashdata in Model? (/showthread.php?tid=5485) |
[SOLVED] set_flashdata in Model? - El Forum - 01-23-2008 [eluser]David Rothera[/eluser] I have a model that does a query and then set's one of three possible flashdata messages regarding the outcome of the query. The problem I am having is that it is not keeping the flashdata outside of the Model, I am using a redirect() so I know that there is definitely a new server request and the variable is not being used and therefore not destroyed. Any suggestions? [SOLVED] set_flashdata in Model? - El Forum - 01-23-2008 [eluser]Craig A Rodway[/eluser] Have you tried a few echo var_export($_SESSION, TRUE); lines at several places within your code to see if the data is being set? Also could you post the code in your model that you're using? [SOLVED] set_flashdata in Model? - El Forum - 01-23-2008 [eluser]David Rothera[/eluser] Just before you replied I was going to edit the initial post, I have put an 'or die()' on the end of the set_flashdata and it seems that it cant actually execute set_flashdata for some reason. [SOLVED] set_flashdata in Model? - El Forum - 01-23-2008 [eluser]David Rothera[/eluser] If I change it from flashdata to userdata it still can't do it, for some reason I cant set session data of any kind from within the model. EDIT: The code from the model, by messing with different debugging I have found that if I set the flash/userdata inside the model and then echo it out in the model as well it is fine however you cannot access any session data from outside the model. EDIT2: I have solved it, I replaced the redirect with a plain anchor and it works now. Code: function addUser($data) |