• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create multidimensional array from two database tables for form_dropdown()

#3
[eluser]suntrop[/eluser]
Thanks for your help. I don't know if I made something wrong, but it doesn't work as expected. I get an array like this …
Code:
Array
(
    [0] => Array
        (
            [0] => Array
                (
                    [customer_id] => 2
                    [customer_name] => Client A
                )

            [1] => Array
                (
                    [customer_id] => 1
                    [customer_name] => Client B
                )

            [2] => Array
                (
                    [customer_id] => 1
                    [customer_name] => Client B
                )

            [3] => Array
                (
                    [customer_id] => 3
                    [customer_name] => Client C
                )

        )

    [1] => Array
        (
            [0] => Array
                (
                    [project_id] => 2
                    [project_title] => Project 2
                )

            [1] => Array
                (
                    [project_id] => 1
                    [project_title] => Project 1
                )

            [2] => Array
                (
                    [project_id] => 4
                    [project_title] => Project 4
                )

            [3] => Array
                (
                    [project_id] => 3
                    [project_title] => Project 3
                )

        )

)

What I need for from_dropdown() is …
Code:
Array
(
    [Client_A] => Array
        (
            [p_id_1] => Project 1
            [p_id_2] => Project 2
            [p_id_3] => Project 3
        )

    [Client_B] => Array
        (
            [p_id_4] => Project 1
            [p_id_6] => Project 2
            [p_id_8] => Project 3
        )

    [Client_C] => Array
        (
            [p_id_5] => Project 1
            [p_id_7] => Project 2
            [p_id_9] => Project 3
        )

)


Messages In This Thread
Create multidimensional array from two database tables for form_dropdown() - by El Forum - 07-24-2011, 10:33 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.