CI 1.6.1 ODBC issue |
|||
|---|---|---|---|
| Date: | 04/17/2008 | Severity: | Minor |
| Status: | Resolved | Reporter: | piotrpolak |
| Version: | 1.6.1 | ||
| Keywords: | |||
| Forum Thread: | http://codeigniter.com/forums/viewthread/77088/ | ||
Description
mysql_num_rows() in ODBC?
Log:
ERROR - 2008-04-17 21:02:30 --> Severity: Warning --> mysql_num_rows(): supplied resource is not a valid MySQL result resource C:\wamp\www\pepiscms\codeigniter\database\drivers\mysql\mysql_result.php 37
The reason was in CI_DB_driver line 37
var $dbdriver = 'mysql';
Example model:
$this->db->select('*');
$this->db->join('usergroups', 'users.group_id = usergroups.group_id');
$this->db->where('user_email', $user_email);
$this->db->where('password', md5($password));
$query = $this->db->get('users');
$row = $query->row();
$this->db->get(‘users’) does not return an object
I find ODBC useless and buggy, it was easier to adopt current postgre driver to work with PHP ODBC functions.
Code Sample
/* CI_DB_odbc_driver
* It is enough add this single line before the constructor (declarations section)
*/
var $dbdriver = 'odbc'; // here!</code>
