Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Combining an array and returning data....

Posted on 2008-10-01
3
Medium Priority
?
259 Views
Last Modified: 2012-05-05
I have 2 arrays, one that looks like this:
<code>
$AltProductInfo[] = array(
                  'orderid' => $OrderID,
                  'affiliation' => '',
                  'total' => $result->fields['price'],
                  'tax' => '',
                  'paymentplan' => $payment_plans,
                  'shipping' => $result->fields['shipping_cost'],
                  'sku'=> $result->fields['sku'],
                  'quantity'=> $result->fields['quantity'],
                  'name'=> '',
                  'category'=> '',
                  'city'=> $billcity,
                  'state'=> $billstate,
                  'country'=> $billcountry
            );
</code>
It will usually have 4 or 5 elements to it.

and then another that looks like this:
(It will only have 1 element)
<code>
$OrderTotal[] = array(
                  'orderid' => $OrderID,
                  'affiliation' => '',
                  'total' => $result->fields['price'],
                  'tax' => ''
            );
</code>

Since a function can only return one value, I need to combine these into 1 array, and then be able to pull them out on the next page.

Thanks!
0
Comment
Question by:interclubs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 9

Expert Comment

by:khaledf
ID: 22619837
use multi dimensional arrays
0
 
LVL 9

Accepted Solution

by:
khaledf earned 2000 total points
ID: 22619862
example
$newArray = array( arr1,arr2);
0
 
LVL 9

Expert Comment

by:khaledf
ID: 22619867
sorry
$newArray = array( $arr1,$arr2);
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question