Solved

Combining an array and returning data....

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
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…

635 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