Solved

Combining an array and returning data....

Posted on 2008-10-01
3
242 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 500 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

752 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