Welcome Guest, Not a member yet? Register   Sign In
object to array as in db
#1

[eluser]Pana_Ruplahlava[/eluser]
Ok, here is the situation. I can do it in php easily and i repeat it often, so there must be an easy way to do it in CI, but i dont know how. I started using it yesterday.

So: in db i have field id and field label and i need it put it into select. as id as value and label as text.

in past 2 hours in user guide i was not able to figure it out.
i assume i have to put it in array so form_dropdown can use it. but how. there must be an easy way... anybody can help? Smile

this is what i was able to get from DB Big Grin
Code:
Array
(
    [0] => Array
        (
            [label] => Fotogalerie
            [id] => 2
        )

    [1] => Array
        (
            [label] => asdasdasd
            [id] => 4
        )

    [2] => Array
        (
            [label] => asdg
            [id] => 5
        )

)


and i need it looking like

Code:
Array
(
'2'=>'Fotogalerie',
'4'=>'asdasdasd',

...
)

Thx for any help Smile


Messages In This Thread
object to array as in db - by El Forum - 10-26-2012, 10:28 AM
object to array as in db - by El Forum - 10-26-2012, 10:43 AM
object to array as in db - by El Forum - 10-26-2012, 10:54 AM
object to array as in db - by El Forum - 10-26-2012, 10:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB