# mySQL--\>php---\>xml

**URL:** <https://forum.kirupa.com/t/mysql-php-xml/180069>\
**Category:** programming\
**Created:** [February 25, 2006, 6:05am UTC](https://forum.kirupa.com/t/mysql-php-xml/180069 "2006-02-25T06:05:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pbrollwitme](https://avatars.discourse-cdn.com/v4/letter/p/439d5e/32.png) [@pbrollwitme](https://forum.kirupa.com/u/pbrollwitme)\
**Post date:** [February 25, 2006, 6:05am UTC](https://forum.kirupa.com/t/mysql-php-xml/180069/1 "2006-02-25T06:05:18Z")

</div>

hey all,  
got a question that i’m having a hard time figuring out.  
I have a database set up like so:

## name | category |

## n1 | c1 |

## n2 | c2 |

## n3 | c1 |

so now i want to create an xml file using php that will look like so:

\<categories\>  
\<category= “c1” /\>  
\<category= “c2” /\>  
\</categories\>

So that it lists all the categories in the database only once.

Anyone know a way to pull this off with php??  
Thanks,  
Mat
