Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

appending to arrays in while loop.. 1

Status
Not open for further replies.

admoore

IS-IT--Management
May 17, 2002
224
US
I have a MySQL query, the results of which are delivered in a while loop- I wish to be able to sort the various results by writing them to an array. Can I not append to a multidimensional array in a while loop?
My array is created like this:
Code:
$report = array( "$user_name"=>array("$subtotal_WD1","$subtotal_WD2","$subtotal_WD3","$subtotal_WE1","$subtotal_WE2","$subtotal_WE3","$agent_subtotal"));

I tried $report .= array, also to no avail...

Perhaps this cannot be done?

TIA,

-Allen M.
 
you can do so implicitly like this
Code:
$report[] = 'something';
this will add a numeric key onto the array. you can also add an associative key as you wish.

you can do this to any element of the array as well

Code:
$report[0][] = 'something else';

you can also use array_push() for explicit control
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top