CodeIgniter Forums

Full Version: error in using ODBC
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]kyko[/eluser]
I am having trouble fetching the data using System DSN and ODBC. When i try issuing a query, it works but when fetching the rows, i got this error message

Code:
Fatal error: Call to a member function result() on a non-object in D:\webroot\sqws\cfapp\controllers\welcome.php on line 21

The script generating the error

Code:
$this->db->like('field', 'JOE');
        $query2 = $this->db->get('database.table');
        foreach ($query2->result() as $row)
        {
           echo $row->field."<br />";
        }

Here's my config

Code:
$db['default']['hostname'] = "System";
$db['default']['username'] = "scrpt";
$db['default']['password'] = "ex0du5";
$db['default']['database'] = "";
$db['default']['dbdriver'] = "odbc";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = FALSE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";

I might be forgetting something..?

El Forum

[eluser]kyko[/eluser]
Got it to work.

you can only use $this->db->query('YOUR QUERY') in odbc connections.