Welcome Guest, Not a member yet? Register   Sign In
Not able to drop tables
#1

[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');
                
    }

}
#2

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

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB