• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upgrade Problem - RESOLVED

#1
[eluser]bdshan[/eluser]
I just upgraded from codeigniter 1.4.1 to 1.5.3. Now when I try to go to my site I get:

A PHP Error was encountered
Severity: Notice

Message: Undefined property: Home::$db

Filename: helpers/entity_helper.php

Line Number: 9

Fatal error: Call to a member function query() on a non-object in D:\wwwroot\test\system\application\helpers\entity_helper.php on line 9

lines 7 to 24 of my entity helper are:
Code:
$oCI =& get_instance();
   $sql = "SELECT ENTITY_NAME, ENTITY_CONTACT, DATE_FORMAT(ENTITY_CREATION_DATE, '%b-%d-%Y') as CRDATE, ENTITY_HOST_IP, ENTITY_INSIM_PORT FROM LU_ENTITY WHERE ENTITY_ID = 1";
   $query = $oCI->db->query($sql);
   if ($query->num_rows() > 0)
   {
      foreach ($query->result() as $row)
      {
         $oCI->config->set_item('entity_name', $row->ENTITY_NAME);
         $oCI->config->set_item('entity_contact', $row->ENTITY_CONTACT);
         $oCI->config->set_item('entity_createdate', $row->CRDATE);
         // used for voting on the acceptance of new members
         $oCI->config->set_item('entity_majority', 4);
         // host file
         $oCI->config->set_item('hostfile',BASEPATH . 'application/data/hosts.svr');
         // world records file
         $oCI->config->set_item('wrfile',BASEPATH . 'application/data/wr.wrs');
      }
   }

Did something change in 1.5.3 that would break this? The entity helper is loaded first thing so now I can't get to my site at all.

#2
[eluser]bdshan[/eluser]
I figured this one out. Even though I have database in to autoload config file, I also have entity in the autoload config file for helpers. Must be that the database library is not loaded yet when the entity help is being loaded. I added $CI->load->database() to the top of the helper and all is working fine.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.