• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
codeigniter session variable taking controller name instead of assigned variable

I've come across a problem where my session variables are taking the name of the controller, instead of the variable assigned.. For example when calling the following URL


class Newprop extends CI_Controller {

public function __construct()
     //....... SNIP

public function index($returnvalue)

public function editProp($propid)
     $this->session->set_userdata(array("propid"=>$propid)); //problem here

I would expect the session info in the database to be
Instead it is
If I echo $propid, the value is indeed 1 before it goes into the session.

If I immediately echo the session data after setting it...

echo $this->session->userdata("propid");

I get "1" even though this is not stored in the DB, but if I try to echo the session data from another controller, I get the string "newprop"

I'm storing session info in the database. If I forgot any other useful information please let me know.

EDIT: If I remove the $this->index($returnvalue); from the editProp() method, the session is set correctly... Not sure if I'm at fault or if CI is

Problem solved, I had an ajax request that was calling
which was setting the session variable a 2nd time. incorrectly.... now how do I delete this post...?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.