Welcome Guest, Not a member yet? Register   Sign In
[Resolved] Oracle and result error
#1

[eluser]nebulom[/eluser]
I'm trying to get back to Oracle. CodeIgniter is version 1.7.1. I tried this on my config.
Code:
$active_group = "oracle";
$active_record = TRUE;

$db['oracle']['hostname'] = "//host:1521/test";
$db['oracle']['username'] = 'name';
$db['oracle']['password'] = "password";
$db['oracle']['database'] = '';
$db['oracle']['dbdriver'] = "oci8";

$db['default']['hostname'] = "localhost";
$db['default']['username'] = "name";
$db['default']['password'] = "password";
$db['default']['database'] = "db_test";
$db['default']['dbdriver'] = "mysql";
$db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
And I have the model as
Code:
function getData() {
        $query = $this->db->get('USERS');
        return $query->result();
    }
It works fine when I change the active_group to default but gives me error when set to oracle.
Code:
Fatal error: Call to a member function row_array() on a non-object in D:\tmxpage\Apache2\htdocs\qc_online_view\branches\with-igniter\system\application\models\stringtag_model.php on line 15
I know I'm missing something. I just can't figure out where. Appreciate anyone's help. Thanks in advance.
#2

[eluser]ELRafael[/eluser]
post the view code, please.

the model returns $ar->result() and probably you have a mistake in view Big Grin
#3

[eluser]nebulom[/eluser]
Thanks for the reply. Here's the view:
Code:
<p>&lt;?php echo anchor('user/add', 'Create New User'); ?&gt;</p>
<table width="100%" cellpadding="3">
  <tr>
    <th>User Name </th>
    <th>Name</th>
    <th>Password</th>
    <th>Actions</th>
    <th>&nbsp;</th>
  </tr>
  &lt;?php if ($users): ?&gt;
  &lt;?php foreach ($users as $user): ?&gt;
  <tr>
    <td>&lt;?php echo $user->USER_NAME; ?&gt;</td>
    <td>&lt;?php echo $user->NAME; ?&gt;</td>
    <td>&lt; NOT SHOWN &gt; </td>
    <td>&lt;?php echo anchor('user/edit/' . $user->ID, 'Edit'); ?&gt;</td>
    <td>&lt;?php echo anchor('user/delete/' . $user->ID, 'Delete'); ?&gt;</td>
  </tr>
  &lt;?php endforeach; ?&gt;
  &lt;?php endif; ?&gt;
</table>
<p>&nbsp;</p>
#4

[eluser]ELRafael[/eluser]
Your view looks ok.

That model code, is the models/stringtag_model.php file?

Maybe you are trying to use row_array() in a non-result var.

Code:
$row = array();
$query = $this->db->query('SELECT field FROM table');
if ( $query->num_rows() > 0 )
  $row = $query->row_array();
return $row;
#5

[eluser]nebulom[/eluser]
[quote author="ELRafael" date="1258558149"]
Maybe you are trying to use row_array() in a non-result var.
[/quote]
I forgot this fires when I pointed to a missing schema. Thanks mate. The error seems to be in the database config. Again, thanks.




Theme © iAndrew 2016 - Forum software by © MyBB