[eluser]ellipsis[/eluser]
Yeah, I don't like galileo either.
I am passing something through $logindata (it contains, among other things, the username). What I'm trying to do is get the id corresponding to the username. Now, with the current code
Code:
function get_id($logindata)
{
$this->db->select('id')->from('users')->where('username', $logindata['username']);
$id=$this->db->get();
return $id;
}
I get quite a few errors and all of them are coming from the sessions library.
Quote:A PHP Error was encountered
Severity: 4096
Message: Object of class CI_DB_mysql_result could not be converted to string
Filename: libraries/Session.php
Line Number: 683
A PHP Error was encountered
Severity: Notice
Message: Object of class CI_DB_mysql_result to string conversion
Filename: libraries/Session.php
Line Number: 683
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\site\system\libraries\Exceptions.php:164)
Filename: libraries/Session.php
Line Number: 662
Edit
Problem fixed for now...
Code:
function get_id($logindata)
{
$this->db->select('id')->from('users')->where('username', $logindata['username']);
$query=$this->db->get();
foreach($query->result() as $row)
{
$id=$row->id;
}
return $id;
}