Q:

ErrorException [ Error ]: Call to a member function save() on a non-object

I keep getting this issue, Im new to fuelphp so I'm not sure of how it fully operates, however this is where my code stops working after I added $program->save();
   $setup->network_rep_comission = Input::post('standard_comission');
             $setup->message = Input::post('message');
            $setup->updated_at = date("Y-m-d H:i:s", time());
             $program->commission_rate = Input::post('commission_rate');
            $setup->save();
            $program->save();
           Session::set_flash('success', "Settings saved successfully");

        }

       $this->template->set_global('setup', $setup);// = "Setup";

Is it because I have double saves? How can I fix this? 

A:

First do you overload your Fuel Php core system ? If not you can use \Input::post() instead of Input::post().
//Secondly put your datas on one array like :
//Don't forgot to put your code on a try catch too

try{
  $setup = array(
     'rep_commission' => \Input::post('network_rep_comission');
     'message'        => \Input::post('message'),
     'updated_at'     => \Input::post('updated_at')
  );
  $program = array(
     'commission_rate' => \Input::post('commission_rate'),
  );

  //Then you can convert your array with your objects properties using setters 
  //methods of your object model :

  \DB::start_transaction();

  $this->setup = new \Model_Setup();
  $this->setup->set_network_rep_comission($setup['rep_commission']);
  $this->setup->set_message($setup['message']);
  $this->setup->set_updated_at($setup['updated_at']);

  $this->setup->save();

  $this->program = new \Model_Program();
  $this->program->set_commission_rate($program['commission_rate']);

  $this->program->save();

  \DB::commit_transaction();

  \Session::set_flash('success', "Settings saved successfully");

}catch(\Exception $ex){
   \DB::rollback_transaction();

}
  $this->template->set_global(array(
     'setup' => $this->setup
  ));

I hope it can help you it's my first comment on stack overflow ^^

