Welcome Guest, Not a member yet? Register   Sign In
Associative Array Argument for form_dropdown()
#2

[eluser]C. Jiménez[/eluser]
You can pre-process your result array in model to send expected data to your controller.
Code:
public function get_titles ()
{
$query = = $this->db->query('SELECT `id`, `name` FROM `employee` WHERE `pos_code` IN (6, 7, 8, 9)');
$raw_data =  $query -> result_array ();
foreach ($raw_data as $line){
             $dropdown_array[$line['id']] = $line['name']
             }
return $dropdown_array;
}


Messages In This Thread
Associative Array Argument for form_dropdown() - by El Forum - 07-10-2011, 10:11 PM
Associative Array Argument for form_dropdown() - by El Forum - 07-11-2011, 01:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB