BOnjour à tous

j'ai un petit souci dans une requete je ne sait pas comment faire pour que ma variable $id change en fonction de ma boucle qui est plus bas.while ($donnees=mysql_fetch_array($resultat)) ......

merci bcp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//FR" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title>xml</title> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
</head>
<body>
 
<?php require_once('connectionbdd.php'); 
 
function Display($Value) {
    return htmlspecialchars(addslashes($Value));
  }
//$cat = $_GET['categorie'];
$parent = 4;
 
 
$connection = mysql_connect($hostname_connectionbdd, $username_connectionbdd, $password_connectionbdd) or die("host : connexion impossible.");
mysql_select_db($database_connectionbdd, $connection) or die("Base de donnée non trouvé.");
$query = "SELECT * FROM articles WHERE idparent_articles = $parent AND idcat_articles = $id" ;
$result = mysql_query($query, $connection) or die("Impossible d'interroger la base de données");
$num = mysql_num_rows($result);
 
 
$resultat = @mysql_query($query);
$i = 0;
$id = "";
 
// on parcourt le résultat de la requête
while ($donnees=mysql_fetch_array($resultat)){
// et on concatène les résultats dans une variable listeResultats
$id = urlencode(utf8_encode($donnees['idcat_articles']));
 
$i++;
 
 
if ($num != 0) {
$file= fopen($id."_"."gallery.xml", "w");
 
$_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n";
 
$_xml .="<simpleviewerGallery 
maxImageWidth = '350' 
maxImageHeight = '350' 
textColor = '0x000000' 
frameColor = '0x000000' 
frameWidth = '0' 
stagePadding = '40' 
thumbnailColumns = '3' 
thumbnailRows = '2' 
navPosition = 'top'
navPadding = '30'
title = '$rub1'
enableRightClickOpen = 'false' 
backgroundImagePath = ''
vAlign = 'top'
hAlign = 'left'
imagePath = /images/' 
thumbPath = '/images/'>\r\n";
 
 
while ($r = mysql_fetch_array($result)) {
 
    $_xml .= '<image>
	<filename>'.utf8_encode($r['images_articles']).'</filename>
	<caption>'.utf8_encode($r['comment_articles']).'</caption>';
    $_xml .= "</image>\r\n";
 
}
}
 
$_xml .="</export>";
if ($num != 0) {
 
fwrite($file, $_xml);
fclose($file); 
}
 
else
 
echo "Pas d'articles pour l'instant dans cette rubrique." ; 
}
echo $id;
?>
 
</body>
 
</html>