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
|
<?php
require_once('ConnexionMysql.php');
mysql_select_db($base);
$requeteSQL="SELECT titre,autheur,duree,them FROM medias";
$reponseSQL = mysql_query($requeteSQL) or die(mysql_error());
$nbligne = mysql_num_rows($reponseSQL);
$resultat_xml = '<?xml version="1.0" encoding="UTF-8" ?>';
$resultat_xml .='<videotheque>';
for($ligne=0; $ligne<$nbligne; $ligne++){
$resultat_xml .='<list>';
$rowsvideo=mysql_fetch_row($reponseSQL);
$resultat_xml .='<video tit="'.mysql_field_name($reponseSQL,0).'">'.utf8_encode($rowsvideo[0]).'</video>';
$resultat_xml .='<video authe="'.mysql_field_name($reponseSQL,1).'">'.utf8_encode($rowsvideo[1]).'</video>';
$resultat_xml .='<video dur="'.mysql_field_name($reponseSQL,2).'">'.utf8_encode($rowsvideo[2]).'</video>';
$resultat_xml .='<video the="'.mysql_field_name($reponseSQL,3).'">'.utf8_encode($rowsvideo[3]).'</video>';
$resultat_xml .='</list>';
}
$resultat_xml .='</videotheque>';
mysql_free_result($reponseSQL);
echo $resultat_xml;
?> |