Re: Creating single row for multiple items.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm assuming because this is part of a shopping cart, so he would have
to put the data into the database only to retrieve it again, which is a
little bit of a waste.

As for how to do it, I'd look through the arrays you have and use
associative arrays (where the order number is the key of the array
element) and set the price if the array element is just being set (use
the isset() function for this) and increment it if it already exists.


Ash
www.ashleysheridan.co.uk
--- Begin Message ---
At 10:04 PM -0600 8/31/08, Tom Shaw wrote:
My array looks very similar to this. I need to create a single row for the
items that have the same order number for CSV export.  I'd prefer to do this
PHP wise instead of SQL. But would appreciate any help I can get.

$ar = array(

   array(

     "order_id" => "34",

     "order_number" => "35Y345Y356YU3",

     "order_name" => "Steinway Grand Piano #11",

     "order_ordered_size" => "Grand",

     "order_sales_price" => "78671.90",

     "order_shipping_price" => "7.85",

     "order_shipping_extra" => "0.06",

   ),


My first question is:

$78 THOUSAND DOLLARS FOR A FRAKING PIANO ???!!!???

Now that I've composed myself.

What's wrong with use MySQL and letting it do the hard stuff?

After all, what you are attempting to do is what MySQL works best at -- namely pull all all the records that have the same order number. Why make it harder on yourself?

Cheers,

tedd




--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux