set relation n-1
- Single Page
Posted 08 September 2012 - 14:48 PM
Posted 08 September 2012 - 15:16 PM
Posted 08 September 2012 - 15:34 PM
Posted 08 September 2012 - 16:49 PM
why do you need this relation?
Posted 08 September 2012 - 19:19 PM
Posted 09 September 2012 - 07:42 AM
[/indent]
function list_invoices()
{
$crud = new grocery_CRUD();
$crud->set_table('invoices');
$crud->set_subject('invoices');
// add a new column "positions"
$crud->columns('invoices_id','company_name','positions');
$crud->callback_column('positions', array($this, 'positions'));
$output = $crud->render();
$this->load->view('header',$output);
}
function positions($value, $row)
{
$html = '<ul>';
$positions = $this->db->get_where('positions',array('invoices_id'=>$row->invoices_id))->result_array();
if($positions)
{
foreach ($positions as $items)
{
$html.='<li>'.$items['title'].'</li>';
}
}
$html.='</ul>';
return $html;
}
[indent=1]helped you?[/indent]
[indent=1]result:[/indent]
[indent=1][attachment=276:a_2.jpg][/indent]