File "powerball.php"
Full Path: /home/analogde/www/Bookmarks/CHESS_ON/powerball.php
File size: 3.47 KB
MIME-type: text/html
Charset: 8 bit
<html>
<title>HOMESITE Patrice DELPY - CHAMPIONNAT POWERBALL </title>
<body bgcolor="#FFFFFF">
<h1 align=center>CLASSEMENT</h1>
<p> </p>
<table width="80%" border="0">
<tr>
<td><img src="powerball.GIF" width="355" height="335"></td>
<td><?
// connexion avec la base
$db_type = "mysql";
$db_user = "analogde";
$db_pass = "rainbow";
$db_name = "analogde";
$db_host = "sql2";
// authentification et connexion
$connexion = mysql_connect($db_host,$db_user,$db_pass);
if(!$connexion)
{ echo "Désolé, y a un bléme, connexion au serveur $db_host impossible\n";
exit;
}
// pointe sur la base
$db = mysql_select_db($db_name,$connexion);
if(!$db)
{ echo "Désolé accés a la base $db_name impossible\n";
}
switch($action)
{
case 'g' :$result = MYSQL_QUERY("select * from powerball order by main_gauche desc"); break;
case 'd' :$result = MYSQL_QUERY("select * from powerball order by main_droite desc"); break;
case 'e' :$result = MYSQL_QUERY("select * from powerball order by endurance desc"); break;
default :$result = MYSQL_QUERY("select * from powerball order by main_droite desc");
}
/*if($action == 'g')
{ $result = MYSQL_QUERY("select * from powerball order by main_gauche desc");
}
if($action == 'd')
{
$result = MYSQL_QUERY("select * from powerball order by main_droite desc");
}
if($action == 'e')
{ $result = MYSQL_QUERY("select * from powerball order by endurance desc");
}
if ($action != 'g' || $action != 'd' || $action != 'e')
{
echo " classement de base";
// recherche le nombre total d'entrée dans la base
$result = MYSQL_QUERY("select * from powerball order by main_gauche desc");
} */
$number = MYSQL_NUM_ROWS($result);
// affiche le nombre d'entrée dans la base
echo "<p align=center>$number enregistrements.</p><br>";
$i=0;
// entête du tableau
echo "<table border=1 align=center width='80%'><tr>
<th>Ordre</th>
<th>Nom</th>
<th>Prénom</th>
<th>
<a href=\"powerball.php?action=g\">Gauche</a>
</th>
<th>
<a href=\"powerball.php?action=d\">Droite</a>
</th>
<th>
<a href=\"powerball.php?action=e\">Endurance</a>
</th>
<th colspan=2>Opérations</th></tr>";
// mise en forme
$classement=0;
while ($i<$number) {
$id=mysql_result($result,$i,"id");
$nom=mysql_result($result,$i,"nom");
$prenom=mysql_result($result,$i,"prenom"); if ($prenom=="") {$prenom="-";}
$gauche=mysql_result($result,$i,"main_gauche");
if ($gauche=="") {$gauche="-";}
$droite=mysql_result($result,$i,"main_droite");
if ($droite=="") {$droite="-";}
$endure=mysql_result($result,$i,"endurance");
if ($endure=="") {$endure="-";}
$classement=$i+1;
// affichage des enregistrements
echo "<tr>
<td align=center width='20'> <b>$classement</b> </td>
<td align=center width='150'> <b>$nom</b> </td>
<td align=center width='150'> $prenom </td>
<td align=center width='150'> $gauche </td>
<td align=center width='150'> $droite</td>
<td align=center width='150'> $endure</td>
<td><a href='modif.php?id=$id'>Modifier</a></td>
<td><a href='effacer.php?eff=$id'>Effacer</a></td></tr>";
$i++;
}
echo "</table>";
// menu de gestion
echo "<br><a href='ajout.php'><p align=center>Ajouter un enregistrement</p></a>";
// referme la connexion avec la base de donne
mysql_close();
?></td>
</tr>
</table>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</p>
</body>
</html>