CodeIgniter Forums

Full Version: Accessin session
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

i got this error when access session

A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Loader::$session

Filename: views/search.php

Line Number: 35

Fatal error: Call to a member function userdata() on a non-object in C:\htdocs\CodeIgniter\system\application\views\search.php on line 35

this is the function in the login model
function checkLogin($username,$password){
$sql = "SELECT * FROM userinfo WHERE Username=? AND Password=?";
$query = $this->db->query($sql, array($username, $password));
if ($query->num_rows() == 1){

$row = $query->row();
$data['searchResult']= "";

$data['title'] = "Welcome to Collaborative Search";
$data['failedType'] =4;



i access the session by echo $this->session->userdata('SessionUsername'); in the search view file.

but i got the aboved mention error.

May i know how to solve?

El Forum

[eluser]GSV Sleeper Service[/eluser]
sounds like the session library is not being loaded. can you post line 35 of views/search.php?