SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast iwiz_seo's Avatar
    Join Date
    Sep 2009
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help to merge multiple arrays?

    Hi all,

    What i need to do to merge the following into a single array?

    PHP Code:
    @Array ( [0] => [1] => ) For The Month Of :@Array ( [0] => For The Month Of : [1] => ) @Array ( [0] => [1] => ) Name:@Array ( [0] => Name: [1] => ) @Array ( [0] => [1] => ) Staff Number :@Array ( [0] => Staff Number : [1] => ) @Array ( [0] => [1] => ) Dept/Location :@Array ( [0] => Dept/Location : [1] => ) @Array ( [0] => [1] => ) Monthly From...To… (mm/dd/yy)@Array ( [0] => Monthly From...To… (mm/dd/yy) [1] => ) @Array ( [0] => [1] => ) @Array ( [0] => [1] => ) Amount (RM)@Array ( [0] => Amount (RM) [1] => ) Total Amount (RM)@Array ( [0] => Total Amount (RM) [1] => ) @Array ( [0] => [1] => ) Grand Total For The Month :@Array ( [0] => Grand Total For The Month : [1] => ) @Array ( [0] => [1] => ) @Array ( [0] => [1] => ) PREPARED BY : @Array ( [0] => PREPARED BY : [1] => ) SIGNATURE :@Array ( [0] => SIGNATURE : [1] => ) DATE:@Array ( [0] => DATE: [1] => ) 
    Thanks for your help!!!

  2. #2
    SitePoint Enthusiast iwiz_seo's Avatar
    Join Date
    Sep 2009
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could some one help me to achieve this!!! Urgent!!!

  3. #3
    SitePoint Member
    Join Date
    May 2010
    Location
    LA
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please describe your question better, so I can help you.

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2005
    Posts
    1,191
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Urgent!!!
    Will get on it in the morning
    In the mean time, using @ isn't a good idea.

  5. #5
    SitePoint Enthusiast iwiz_seo's Avatar
    Join Date
    Sep 2009
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi sbbtina,

    I want to merge the following arrays as a single array and then want to access.

    Array ( [0] => [1] => ) Array ( [0] => For The Month Of : [1] => ) Array ( [0] => [1] => ) Array ( [0] => May [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => Year: [1] => ) Array ( [0] => 2010 [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => Name: [1] => ) Array ( [0] => [1] => ) Array ( [0] => Vasu [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => Staff Number : [1] => ) Array ( [0] => [1] => ) Array ( [0] => 552041 [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => Dept/Location : [1] => ) Array ( [0] => [1] => ) Array ( [0] => Admin/Chennai [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => Monthly From...To… (mm/dd/yy) [1] => ) Array ( [0] => OVERTIME & STANDBY CLAIM [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => TRAVEL CLAIM [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => REIMBURSEMENT [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => Weekdays (RM13/hr) [1] => ) Array ( [0] => Saturday (RM13/hr) [1] => ) Array ( [0] => Sun & P.Holiday (RM17/hr) [1] => ) Array ( [0] => Standby (RM3.50/ hr) [1] => ) Array ( [0] => Mileage CAR (KM) [1] => ) Array ( [0] => Mileage Motorcycle (KM) [1] => ) Array ( [0] => Taxi (RM) [1] => ) Array ( [0] => Parking (meter) (RM) [1] => ) Array ( [0] => Parking (ticket) (RM) [1] => ) Array ( [0] => Toll (RM) [1] => ) Array ( [0] => Others (RM) [1] => ) Array ( [0] => Handphone (Postpaid) (RM) [1] => ) Array ( [0] => Handphone (Prepaid) (RM) [1] => ) Array ( [0] => Others (RM) [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => 0.784615384615 [1] => ) Array ( [0] => 1.1 [1] => ) Array ( [0] => 0.664705882353 [1] => ) Array ( [0] => 0 [1] => ) Array ( [0] => 0 [1] => ) Array ( [0] => 0 [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => Amount (RM) [1] => ) Array ( [0] => 10.20 [1] => ) Array ( [0] => 14.30 [1] => ) Array ( [0] => 11.30 [1] => ) Array ( [0] => 10.20 [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => [1] => ) Array ( [0] => Total Amount (RM) [1] => ) Array ( [0] => 46.00 [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => 0.00 [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => Grand Total For The Month : [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => 46.00 [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => CHECKED BY : [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => PREPARED BY : [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => (Team Leader), if any [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => MGR'S APPROVAL: [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => SIGNATURE : [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => NAME: [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => NAME: [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => DATE: [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => DATE: [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => DATE: [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => ) Array ( [0] => [1] => )
    As you can see there are many arrays and each has two elements. All i want to do is convert the above arrays into single and then want to access the elements.

    Thanks for your help!!!

  6. #6
    SitePoint Enthusiast iwiz_seo's Avatar
    Join Date
    Sep 2009
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi sbbtina,

    Please see my previous reply and let me know what do i need to do!!

    Again thanks for you help.

  7. #7
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    4,998
    Mentioned
    100 Post(s)
    Tagged
    0 Thread(s)
    Are the arrays being created from a database results set? Is so how are you reading the results set into the arrays?
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  8. #8
    SitePoint Enthusiast iwiz_seo's Avatar
    Join Date
    Sep 2009
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That is not from database. Those data coming from an excel sheet.

    I have an excel sheet and want to upload. But the excel sheet does not maintain any order. Following is sample data.

    MONTHLY CLAIMS SUMMARY


    For The Month Of : May Year: 2010

    Name: Vasu

    Staff Number : 552041

    Dept/Location : Admin/Chennai

    Monthly From...To… (mm/dd/yy) OVERTIME & STANDBY CLAIM TRAVEL CLAIM REIMBURSEMENT
    Weekdays (RM13/hr) Saturday (RM13/hr) Sun & P.Holiday (RM17/hr) Standby (RM3.50/ hr) Mileage CAR (KM) Mileage Motorcycle (KM) Taxi (RM) Parking (meter) (RM) Parking (ticket) (RM) Toll (RM) Others (RM) Handphone (Postpaid) (RM) Handphone (Prepaid) (RM) Others (RM)
    0.8 1.1 0.7 0.0 0.0 0.0 0.00
    Amount (RM) 10.20 14.30 11.30 10.20 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
    Total Amount (RM) 46.00 0.00 0.00

    Grand Total For The Month : 46.00

    CHECKED BY :
    PREPARED BY : (Team Leader), if any MGR'S APPROVAL:
    SIGNATURE : NAME: NAME:
    DATE: DATE: DATE:
    First row contains the tile of the sheet and next row has name and value pair and so on. Please tell me how to upload one values to database and skip the names.

    Thanks for your help.

  9. #9
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,396
    Mentioned
    61 Post(s)
    Tagged
    0 Thread(s)
    How familiar are you with PHP, basic string parsing functions/techniques, etc.? We'll help you learn but we won't* write entire solutions for you. What have you tried so far, anything?

    * Unless someone is feeling excessively helpful and/or bored
    Salathe
    Software Developer and PHP Manual Author.

  10. #10
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    69 Post(s)
    Tagged
    0 Thread(s)
    You're missing a few pieces of information...
    I assume that these are arrays inside of another array.
    In which case, foreach() the array, collapse (implode on Space character, and trim?) the elements,and you've got what you want.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •