Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #5862

Transforming object properties?

From Mike <mpearl1@gmail.com>
Newsgroups comp.lang.php
Subject Transforming object properties?
Date 2012-05-08 16:44 -0700
Organization http://groups.google.com
Message-ID <16764404.423.1336520688722.JavaMail.geo-discussion-forums@pblw1> (permalink)

Show all headers | View raw


I need an array of objects that looks like this:

$items[$i]->name
          ->new_amount
          ->old_amount

The data would look like this:

name          new_amount          old_amount
John          500.00              200.00      
Sue           15.00               <NULL>
Frank         254.00              <NULL>
Max           <NULL>              28.00The data would look like this:

But the results of my sql query comes back as:

$items[$i]->name
          ->type
          ->amount

name          type          amount
----------------------------------
John          new_amount    500.00
John          old_amount    200.00
Sue           new_amount    15.00
Frank         new_amount    254.00
Max           old_amount    28.00

Is there a reasonable way to accomplish this?

Thanks!

Mike

Back to comp.lang.php | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Transforming object properties? Mike <mpearl1@gmail.com> - 2012-05-08 16:44 -0700
  Re: Transforming object properties? Jeff North <jnorthau@yahoo.com.au> - 2012-05-09 11:01 +1000
    Re: Transforming object properties? Mike <mpearl1@gmail.com> - 2012-05-09 14:57 -0700
      Re: Transforming object properties? Captain Paralytic <paul_lautman@yahoo.com> - 2012-05-10 03:24 -0700
      Re: Transforming object properties? Jeff North <jnorthau@yahoo.com.au> - 2012-05-15 10:28 +1000
        Re: Transforming object properties? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-05-15 20:09 +0200
  Re: Transforming object properties? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-09 10:02 +0200
    Re: Transforming object properties? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-05-09 10:05 +0200

csiph-web