I've defined the $has_many in both models, I'm using the htmlform extension to generate the form and it generates the options correctly.
The portion of my controller that saves looks like this:
Code:
if (!empty($_POST)) {
$data->provider->from_array($_POST);
$sc = new Servicecategory();
$sc->where_in('id', $this->input->post('servicecategory'))->get();
if ($data->provider->save($sc)) {
redirect('admin/services/providers');
}
}
I can't figure out what I'm doing wrong. If I change the SQL query to the following I get a result.
Code:
SELECT COUNT(*) AS `numrows` FROM (`servicecategories_serviceproviders`), `servicecategories` WHERE ( `servicecategories`.`id` NOT IN (1) ) AND `serviceprovider_id` = 1