Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 5th, 2007, 11:13 PM   #1
MiKuS
Programmer
 
Join Date: Jun 2007
Posts: 93
Rep Power: 2 MiKuS is on a distinguished road
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
MiKuS is offline   Reply With Quote
Old Sep 6th, 2007, 1:38 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I would suggest that you are wasting resources. Investigate an array of arrays.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Sep 6th, 2007, 2:20 AM   #3
MiKuS
Programmer
 
Join Date: Jun 2007
Posts: 93
Rep Power: 2 MiKuS is on a distinguished road
thanks for your advice DaWei,

for anyone interested a 3d array was the way to go.
MiKuS is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Confusion With Pointers and Arrays JawaKing00 C 10 Sep 14th, 2006 7:33 AM
Arrays or Vectors? can342man C++ 2 Apr 20th, 2006 3:57 PM
Pairing elements of two arrays...please help!!! smg1001 Java 14 Jan 17th, 2006 5:01 PM
Arrays in PHP MrMan9879 PHP 6 Jan 12th, 2006 9:18 PM
Arrays Gunman C++ 17 Oct 20th, 2005 6:11 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:19 PM.

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