Welcome Guest, Not a member yet? Register   Sign In
usint form_dropdown()
#2

Return an object from your model and then pass the object to this helper method.

PHP Code:
// -----------------------------------------------------------------------

/**
 * Convert an Object to an Associated Array.
 * 
 * Add to one of your helpers.
 */
if ( ! function_exists('objToAssocArray'))
{
    function 
objToAssocArray(object $object)
    {
        
// Converting object to associative array
        
return json_decode(json_encode($object), true);
    }


Call it like this.

PHP Code:
$options objToAssocArray($yourObject); 

See if that works for you.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
usint form_dropdown() - by Martin_Salas - 09-02-2020, 10:24 PM
RE: usint form_dropdown() - by InsiteFX - 09-03-2020, 04:02 AM
RE: usint form_dropdown() - by Martin_Salas - 09-03-2020, 06:37 PM
RE: usint form_dropdown() - by InsiteFX - 09-04-2020, 12:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB