Imbricated request

Hello,

I’m trying to make a website site with several cascading menus (Actionscript 2.0).
It’s the first time I’m working with XML. I’m trying to extract my database data (MySQL) and format it in a valid XML file.

I have to tables : ‘author’ and ‘works’. I’d like to execute an imbricated request : for each author, i’d like to extract his works. (The fields author.firstname and works.author are the same.)

I wrote this code but it doesn’t work :

<?php 

$id = mysql_connect("localhost:8889","root","root");

mysql_select_db("pixovecto");

$query = "SELECT * FROM auteur" ;
$result = mysql_query($query,$id);

$compteur=0;

while ($liste = mysql_fetch_array($result))
{
$travaux = "SELECT * FROM travaux WHERE travaux.auteur=".$liste[prenom] ;
echo "&nom".$compteur."=".utf8_encode(($liste[nom]));
echo "&prenom".$compteur."=".utf8_encode(($liste[prenom]));
echo "&animation".$compteur."=".utf8_encode(($liste[animation]));
echo "&specialite".$compteur."=".utf8_encode(($liste[specialite]));
echo "&texte".$compteur."=".utf8_encode(($liste[texte]));
echo "&adresse".$compteur."=".utf8_encode(($liste[adresse]));
echo "&tel".$compteur."=".utf8_encode(($liste[tel]));
echo "&mail".$compteur."=".utf8_encode(($liste[mail]));
    $i=0;
    while ($liste2 = mysql_query($travaux,$id))
    {
        echo "&titre".$i."=".utf8_encode(($liste2[titre]));
        echo "&categorie".$i."=".utf8_encode(($liste2[categorie]));
        echo "&vignette".$i."=".utf8_encode(($liste2[vignette]));
        echo "&img".$i."=".utf8_encode(($liste2[img]));
        echo "&commentaire".$i."=".($liste2[commentaire]);
        echo "&date".$i."=".($liste2[date]);
    $i++;
    }
$compteur++;
}

mysql_free_result ($result);

?>

Thank you for your help,

Raphaël