problems with $_SESSION - 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: problems with $_SESSION (/showthread.php?tid=26249) |
problems with $_SESSION - El Forum - 01-09-2010 [eluser]_SC_[/eluser] Hi all, I have some troubles with $_SESSION. In my controller I have : Code: $this-> MAdmins-> verifyUser($u,$pw); Code: function verifyUser($u,$pw){ Quote:if ($_SESSION['userid'] > 0) ...I get an error: Message: Undefined index: userid How I can fix this? Another problem is : why i dont get the messange set in flashdata? how set_flashdata works? When you print the message? Inside the module or into the controller when you use the $_SESSION object? problems with $_SESSION - El Forum - 01-09-2010 [eluser]gigas10[/eluser] Did you declare session_start() in the constructor of your controller class just after the parent::Controller() line? Code: function __construct(){ problems with $_SESSION - El Forum - 01-09-2010 [eluser]_SC_[/eluser] yes: function Welcome() { parent::Controller(); session_start(); } problems with $_SESSION - El Forum - 01-09-2010 [eluser]gigas10[/eluser] Oh I see the problem, at least how to get rid of the error message: Code: if (isset($_SESSION['userid']) && $_SESSION[‘userid’] > 0){ Also to display flash data you do it in the view. Code: echo $this->session->flashdata('error'); problems with $_SESSION - El Forum - 01-09-2010 [eluser]_SC_[/eluser] oh thank you very much! |