I use this code to verify the user.
public function verify_user($username, $password)
{
$q = $this->db->where('username', $username)
->where('password', md5($password))
->limit(1)
->get('users');
if ($q->num_rows() === 1) {
echo '<pre>';
print_r($q->row());
echo '</pre>';
} else {
echo 'EMPTY';
}
}
But, when it equals 1, it display nothing.
Array
(
)
It appear when I use this code to fix odbc num_rows = -1 issue: CODEIGNITER Issue on line 40 until 67
EDIT =============================
What I want to achive is this
stdClass Object
(
[id_user] => 2
[username] => 114080077
[password] => 0d5ccab9e7f4ae3fe040f143046e386c
)
Code that I modify is:
Before (STABLE VERSION):
/**
* Number of rows in the result set
*
* @access public
* @return integer
*/
function num_rows()
{
return @odbc_num_rows($this->result_id);
}
After (ISSUE FIX):
/**
* Number of rows in the result set
*
* @return int
*/
public function num_rows()
{
if (is_int($this->num_rows))
{
return $this->num_rows;
}
elseif (($this->num_rows = @odbc_num_rows($this->result_id)) !== -1)
{
return $this->num_rows;
}
// Work-around for ODBC subdrivers that don't support num_rows()
if (count($this->result_array) > 0)
{
return $this->num_rows = count($this->result_array);
}
elseif (count($this->result_object) > 0)
{
return $this->num_rows = count($this->result_object);
}
return $this->num_rows = count($this->result_array());
}
You can’t just use the development version of
CI_DB_odbc_resultand keep the rest of the stuff from the 2.1 version tree. If you don’t want to replace all of them, what you need to get from the repository are the following files:(assuming that you only use ODBC)
There still could be an issue with the ODBC result class and I’ll look into that, but considering that your question refers to a yet unreleased version of CodeIgniter – it would be better that you post any problem reports to either the CodeIgniter forums or the GitHub repository.