Welcome Guest, Not a member yet? Register   Sign In
Dynamically fill an array from Mysql using Form Helper for dropdown list.
#9

[eluser]pasquattro[/eluser]
Hi, im very new to this and would like to use DCZ's code. Could someone explain the code for the model so I can try and implement it.

Code:
function get_dropdown_array($key, $value, $from){
        $result = array();
        $array_keys_values = $this->db->query('select '.$key.', '.$value.' from '.$from.' order by id asc');
       foreach ($array_keys_values->result() as $row)
        {
            $result[$row->$key]= $row->$value;
        }
        return $result;
    }

thanks.


Messages In This Thread
Dynamically fill an array from Mysql using Form Helper for dropdown list. - by El Forum - 08-31-2009, 12:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB