Fatal error: Can't use method return value in write context in ci

Replace the first if statement with if( ! $this->session->userdata('user_id') ).

The empty function check if a variable is empty but userdata is a function. Additionally, for your information, according to the CodeIgniter documentation, the userdata function returns FALSE if the item doesn't exist, which means that if user_id doesn't exist in your session, the code in the else will be executed.

ref: https://stackoverflow.com/questions/6730216/cant-use-method-return-value-in-write-context

Comments

Popular posts from this blog

dynamic create multiple ckeditor onclick event using jquery

online visitor counter