# Mysql \>\> Php \>\> Xml

**URL:** <https://forum.kirupa.com/t/mysql-php-xml/225293>\
**Category:** programming\
**Created:** [May 10, 2007, 2:05pm UTC](https://forum.kirupa.com/t/mysql-php-xml/225293 "2007-05-10T14:05:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![magjac](https://avatars.discourse-cdn.com/v4/letter/m/ba8739/32.png) [@magjac](https://forum.kirupa.com/u/magjac)\
**Post date:** [May 10, 2007, 2:05pm UTC](https://forum.kirupa.com/t/mysql-php-xml/225293/1 "2007-05-10T14:05:01Z")

</div>

I have all the connections working etc but i cant get my PHP script to make a new .XML file

Can anyone see whats wrong?

```auto
$sql = "SELECT * FROM apris"; 
    $result=mysql_query($sql) or die("query failed: $sql - ". mysql_error()); 
    $filename = "apris.xml";
    while($line = mysql_fetch_assoc($result)){
        $fp = fopen($filename, "w");

        fwrite($fp, $line);

        fclose($fp);}

```
