# Echo array in one row

**URL:** <https://forum.kirupa.com/t/echo-array-in-one-row/307240>\
**Category:** programming\
**Created:** [March 31, 2010, 9:10am UTC](https://forum.kirupa.com/t/echo-array-in-one-row/307240 "2010-03-31T09:10:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![LittleMore](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@LittleMore](https://forum.kirupa.com/u/LittleMore)\
**Post date:** [March 31, 2010, 9:10am UTC](https://forum.kirupa.com/t/echo-array-in-one-row/307240/1 "2010-03-31T09:10:04Z")

</div>

Hi to All,

I am new in the forum as new member. I have been using this forum for a long time although did not require posting anything as I could find lot of info from your contributions to this valuable forum. Today I have a question for which I could not find an answer.

Question is…

I have a MySQL category and subcategory entries as follows:

```
 CatID ParentID Name     
 3177 0 first 
 3178 0 second 
 3179 0 third 
 3180 0 fourth
 3181 0 fifth
 3182 0 sixth
 3189 0 seventh
 3190 0 eigth
 3196 3181 ten     
 3198 3196 twenty           
 3199 3196 thirty           
 3200 3196 forty     
 3203 3196 fifty       
 3206 3181 sixty           
 3207 3196 seventy            
 3208 3199 eighty     

```

I can read query from above in array.

I need to know the following if I use the GET method to post the CatID.  
I want to echo all subcategories (in descending order based on CatID) up to the first Parent in one row with hyphens as follows:  
i.e. (based on CatID 3208) echo --\> eighty-thirty-ten-fifth

Any suggestions to write the PHP code to display it?  
I will be able to use it in my own function.

Thank you.
