include "common.php";
$titre="Musiciens";
$ident="musiciens";
$date_cvs='$Date: 2003/09/03 22:06:53 $';
include "header.php";
$user="anonymous";
$host="localhost";
$database="musique";
?>
Voici quelques musiciens
$orderby=urldecode($_POST['orderby']);
if (!$orderby)
$orderby="nom";
$connection=mysql_connect($host,$user)
or die("Impossible de se connecter");
mysql_select_db($database)
or die("Impossible de sélectionner la base de données");
?>
\n";
$query="select distinct mus.id as id,pr�nom,nom,DATE_FORMAT(naissance,'%d/%m/%Y'),lieu_n,".
"DATE_FORMAT(mort,'%d/%m/%Y'),lieu_m,nationalit� from ".
"musiciens as mus,qualit� as qua where mus.id=qua.id and (0 $qualites) ".
"order by $orderby,nom,pr�nom";
$result=mysql_query($query) or die("�chec de la requ�te: ".mysql_error());
echo "\n";
echo "\n";
echo "Pr�nom";
echo " | Nom";
echo " | Date de naissance";
echo " trie selon le jour";
echo " | Lieu de naissance";
echo " | Date de d�c�s";
echo " trie selon le jour";
echo " | Lieu de d�c�s";
echo " | Nationalit�\n";
echo " | Qualit�\n";
while ($line=mysql_fetch_array($result,MYSQL_ASSOC))
{
$id=$line['id'];
echo " |
\n";
foreach ($line as $key => $val)
{
if ($key=='id') continue;
if (!$val)
$val=' ';
if (preg_match("|^00/00/(\d*)$|",$val,$match))
{
# $val="??/??/$match[1]";
$val="$match[1]";
}
if ($key=='lieu_n' || $key=='lieu_m')
{
if (preg_match("/^([^\(]+\S)\s*\((.*)\)$/",$val,$match1))
{
$ville1=$ville=$match1[1];
if (preg_match('/^\s*(\S[^\[]*\S)\s*\[([^\]]*)\]\s*$/',
$ville1,$res1))
{
$ville=$res1[1];
$ville1=$res1[2];
}
$tab_tmp=split(',',$match1[2]);
$pays=de_hyphen(array_pop($tab_tmp));
$pays1=$pays=preg_replace('/^\s*(\S.*\S)\s*$/','$1',$pays);
if (preg_match('/^\s*(\S[^\[]*\S)\s*\[([^\]]*)\]\s*$/',
$pays,$res1))
{
$pays=$res1[1];
$pays1=$res1[2];
}
$ville1=de_hyphen(preg_replace('/\s+/','+',$ville1));
if (preg_match('/^\d+$/',$pays1))
$pays1='fr';
if ($tab_pays[$pays1])
$pays1=$tab_pays[$pays1];
$pays1=preg_replace('/\s+/','+',$pays1);
echo " $ville | \n";
}
else
echo " $val | \n";
}
else
{
if ($key=='nom' && $val=='Offenbach')
echo " $val | \n";
else
echo " $val | \n";
}
}
// reste les qualit�s
$res2=mysql_query("select qualit� from qualit� as qua where id=$id and ".
"(0 $qualites) order by qualit�")
or die("Echec de la requ�te: ".mysql_error());
$tmp=array();
while ($line2=mysql_fetch_array($res2,MYSQL_ASSOC))
{
array_push($tmp,$line2['qualit�']);
}
echo " ",join(" ",$tmp)," | \n";
}
echo "
\n";
mysql_free_result($result);
mysql_close($connection);
?>
include "footer.php";
?>