CodeIgniter Forums
error in using ODBC - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: error in using ODBC (/showthread.php?tid=11925)



error in using ODBC - El Forum - 09-28-2008

[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..?


error in using ODBC - El Forum - 10-05-2008

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

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