CodeIgniter Forums
Not able to drop tables - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Not able to drop tables (/showthread.php?tid=29337)



Not able to drop tables - El Forum - 04-06-2010

[eluser]shinokada[/eluser]
When I visit http://127.0.0.1/ci/index.php/welcome/cronjob, I get the following error message.

What am I doing wrong here?
Your help will be appreciated.
Thanks in advance.

Quote:A PHP Error was encountered

Severity: Notice

Message: Undefined property: Mcronjob::$dbforge

Filename: models/Mcronjob.php

Line Number: 13

Fatal error: Call to a member function drop_table() on a non-object in C:\xampp\htdocs\ci\modules\welcome\models\Mcronjob.php on line 13

controller
Code:
function cronjob(){
        $this->load->model('Mcronjob');
        $this->Mcronjob->cronjob();
        echo "success!";
        
    }
model

Code:
class Mcronjob extends Model{
     function Mcronjob(){
         parent::Model();
         $this->load->database();
        
     }
    
     function cronjob(){

         $this->load->dbforge();
         $this->dbforge->drop_table('shoutbox');
                
    }

}



Not able to drop tables - El Forum - 04-06-2010

[eluser]InsiteFX[/eluser]
Try loading the database in function cronjob, or autoload it.

InsiteFX