mrras25 Posted December 13, 2007 Share Posted December 13, 2007 I dont know why I cant remember this of all basic things to do (to much perl I guess). I assumed that if I looped through my query to build an array it would just append it to right area. I have a query that returns data like this: 2Bell|HP|6047|45807 2Bell|HP|13757|45807 2Bell|HP|5134|45807 2Bell|HP|3087|45807 2Bell|HP|2063|45807 2Bell|HP|2063|45807 2Bell|HP|2063|45807 2Bell|HP|2062|45805 2Bell|HP|2137|45807 2Bell|HP|2064|45807 2Bell|HP|2064|45807 2Bell|HP|2064|45807 ......... as you can see there a lot of identical "sites (2Bell)" and "Vendors (HP)" the idea is to group and build an array that would look like this: $array (2Bell => (HP =>(size1,size2,size3),EMC =>(size1,size2,size3)),Bothell =>(HP =>(size1,size2,size3),...); the code i have so far: <code> while($data = $DB->Fetch($query)) { $dtarr[] = array($data["location"] => array($data["vender"] => array($data["array"] => array($data["alloc"],$data["unalloc"])))); } </code> Quote Link to comment Share on other sites More sharing options...
Barand Posted December 13, 2007 Share Posted December 13, 2007 <?php while($data = $DB->Fetch($query)) { $dtarr[$data["location"]][$data["vendor"]][] = array( $data['other'], $data['other1']); } Quote Link to comment Share on other sites More sharing options...
mrras25 Posted December 13, 2007 Author Share Posted December 13, 2007 This is why you are my friend are a genius... I knew I was brain farting this. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.