Welcome Guest, Not a member yet? Register   Sign In
Undefined index for session data item

The following bit of code is returning an undefined index error/notice on the first line (discount_rate) but in my understanding, if a userdata entry doesn't exist, then false should be returned. I know that the error is just a notice and that such errors can be hidden, but I don't really see why I am getting the error at all (well, obviously because the entry doesn't exist, but it should be being "handled").

if(!$this->session->userdata['discount_rate']) {
     $this->session->set_userdata['discount_rate'] = 1;

If anyone can suggest a way to test whether a userdata item exists, then please share!! Thanks!

Theme © iAndrew 2016 - Forum software by © MyBB