![]() |
having problems with session_start - 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: having problems with session_start (/showthread.php?tid=19833) |
having problems with session_start - El Forum - 06-19-2009 [eluser]Unknown[/eluser] I am reading the CI book by Wrox and am going through the sample code. Everything was goiing fine until I was in Chpater 6, where I had to run through a native PHP session to construct an administrator login. Copied the code, tried it but I get an error indicating that the session variables I had assigned value with in my models does not exist. Here are the main points: The Controller: Code: $user = $this->input->post('username'); The Model: Code: //perform database query The View: Code: <?php I am getting an error undefined index : userid or undefined index: username I have started the session via: Code: function Administrator() What could I be doing wrong? having problems with session_start - El Forum - 06-20-2009 [eluser]TheFuzzy0ne[/eluser] Welcome to the CodeIgniter forums. Your select query needs to look like this: Code: $this->db->select('id, username'); The method only takes two arguments. The first one is the string representing the fields you want to select, and the second is to prevent escaping, for times you you need to do something like this: Code: $this->db->select('COUNT(*)', FALSE); having problems with session_start - El Forum - 06-21-2009 [eluser]Unknown[/eluser] whoa! I knew that mechanism yet why haven't I noticed that! Will try rty now...hope this works now. I was already banging my head against the wall thinking that I may have put session_start() in the wrong place. |