Solved

Combining an array and returning data....

Posted on 2008-10-01
3
228 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
  • 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now