Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   joining associative arrays (http://www.programmingforums.org/showthread.php?t=13927)

MiKuS Sep 5th, 2007 11:13 PM

joining associative arrays
 
I have 3 arrays, they all hold the same information except for one row, which changes in each of the arrays:

:

    [cal_id] => 7
    [cal_create_by] => admin
    [cal_date] => 20070704
    [cal_time] => 60000
    [cal_duration] => 120
    [cal_name] => Test Address
    [cal_description] => This is whats wrong with the machine
    [cal_data] => 5982462
    [cal_login] => user1
    [cal_lastname] => person
    [cal_firstname] => one
--
    [cal_id] => 7
    [cal_create_by] => admin
    [cal_date] => 20070704
    [cal_time] => 60000
    [cal_duration] => 120
    [cal_name] => Test Address
    [cal_description] => This is whats wrong with the machine
    [cal_data] => $106. Please call 1/2 hour prior to arriving.
    [cal_login] => user1
    [cal_lastname] => person
    [cal_firstname] => one
--
    [cal_id] => 7
    [cal_create_by] => admin
    [cal_date] => 20070704
    [cal_time] => 60000
    [cal_duration] => 120
    [cal_name] => Test Address
    [cal_description] => This is whats wrong with the machine
    [cal_data] => Map 145 - H1 
    [cal_login] => user1
    [cal_lastname] => person
    [cal_firstname] => one


How can i join these arrays so i have something like

:

    [cal_id] => 7
    [cal_create_by] => admin
    [cal_date] => 20070704
    [cal_time] => 60000
    [cal_duration] => 120
    [cal_name] => Test Address
    [cal_description] => This is whats wrong with the machine
    [cal_data1] => 5982462
    [cal_data2] => $106. Please call 1/2 hour prior to arriving.
    [cal_data3] => Map 145 - H1 

    [cal_login] => user1
    [cal_lastname] => person
    [cal_firstname] => one


DaWei Sep 6th, 2007 1:38 AM

I would suggest that you are wasting resources. Investigate an array of arrays.

MiKuS Sep 6th, 2007 2:20 AM

thanks for your advice DaWei,

for anyone interested a 3d array was the way to go.


All times are GMT -5. The time now is 10:56 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC