my $this->save() is not working, need help


I need help on this, i have the code below and i need to save the data to this table. The model is generate by gii and it point to the correct table already, but when i call this controller to it wont insert the data to the table, any ideas? Some others function also have using the save() but it works, anything wrong with my code?

In controller

$modelC2cCustomers = new C2cCustomers;

$C2cCustomersData = array(‘customers_id’=>‘999’, ‘username’=>‘999’,

		'buyer_order_level'=>'0', 'seller_group_id'=>'1', 

		'seller_product_level'=>'0', 'seller_status'=>'1',                                      'seller_create_listing_permission'=>'0','seller_product_listing_limit'=>'20');


In the C2cCustomers model

public function insertC2cCustomers($data){

foreach($data as $column => $info){

$this->$column =$info;




probably the validation fails. you can check your validation rules in you model at the "rules" or use save(false) instead of save().

but your code looks strange. you should set the attributes of the model in your controller and use the save method from there. there is no point to have a save replacement method in your model.

Make sure that every attribute is at least marked as ‘safe’ on your model’s rules