• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
strange ci_sessions error when attempting to query user table

function _getDocumentCap()
            $id = $this->session->userdata('UserID');
            $query = $this->db->get('user');
            foreach ($query->result_array() as $row)
                $doc = $row['NoOfUserDocs'];
            return $doc;

Quote:A Database Error Occurred
Error Number: 1054

Unknown column 'UserID' in 'where clause'

UPDATE `ci_sessions` SET `last_activity` = '1250080844', `user_data` = 'a:13:{s:8:\"username\";s:15:\"user

I have no clue what is going on here. Any help would be appreciated

Quote:Unknown column ‘UserID’ in ‘where clause’

The error message tells you that there is no column named "UserID" in your table.
Userdata is saved in a serialized array in the the column "user_data", so you can't use the SQL WHERE.

What exactly do you want to achieve?

Thanks for the reply. I have now changed the way i am writing the query.

i was trying to return some data from the users table, but I was unsure why it was giving me an error about ci_sessions; the UserID field is present.

I dont fully understand the way ci works so i will do some more learning.

All sorted anyway :-)

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

Users browsing this thread:
1 Guest(s)

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