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 90 91 92 93 94 95
| <? $URL = $PHP_SELF;
$table="Joueurs";
if($numero) { // Ajout de la fiche
$query = "INSERT INTO $table(Nom,Numero)";
$query .= " VALUES('$nom','$numero')";
$result = mysql_query($query);
$message = "Fiche <b>".$nom." - ";
$message .= $numero."</B> ajoutée !";
}
elseif($del) { // Suppression du Numero
$query = "DELETE FROM $table"
." WHERE Numero = '$del'";
$result = mysql_query($query);
$message = "Numero <b>".$del;
$message .= "</b> supprimé !";
}
elseif($mod2) { // Modif du Numero
$query = "UPDATE $table SET Numero='$mod2'";
$query .= " WHERE Numero='$mod1' ";
$result = mysql_query($query);
$message = "Numero <b>".$mod1."</b>";
$message .= "<br>modifié en <b>".$mod2."</b> !";
}
?>
<HTML><HEAD><TITLE>Exemple</TITLE>
<style type="text/css" media="screen">
@import url( css.css );
</style>
</HEAD>
<BODY>
<table width=100% height=100%><tr><td><center>
<? echo $message; ?>
<? if($mod) { // saisie du nouveau
?> <form method="post" action="<? echo $URL; ?>">
Modifier <b><? echo $mod; ?></b> en :<br>
<input type="text" name="mod2"
value="<? echo $mod; ?>">
<input type="hidden" name="mod1"
value="<? echo $mod; ?>">
<input type="Submit" value="Modifier">
</form>
<?
}
?>
<form method="post" action="<? echo $URL; ?>"
onSubmit="return test(this.Nom,this.Numero)">
<table><tr>
<td>Nom</td>
<td><input type="text" name="Nom"></td>
<td>Numero</td>
<td><input type="text" name="Numero"></td>
</tr><tr>
<th colspan=4>
<input type="Submit" value="Ajouter">
</th>
</tr></table>
</form>
<? // sélection des fiches
$query = "SELECT `id` ,`Numero` ,`Nom` , `Prenom` FROM Joueurs
WHERE 1 AND `Niveau`
LIKE 'Juniors'AND `Actif`
LIKE 'oui'
ORDER BY `Joueurs`.`Nom` ASC ";
$result = mysql_query($query); $i=1; ?>
---- vérification du contenu des
<? echo mysql_numrows($result); ?>
fiches de la base ----
<BR><BR><table border=0>
<? while ($val = mysql_fetch_array($result)) { ?>
<tr>
<td>Fiche <? echo $val["id"]; ?></td>
<td>
<? echo $val["Nom"]." ".$val["Prenom"]; ?>
</td>
<td>
<? echo $val["Numero"]; ?>
</td>
<td>
<td nowrap>
<A href="<?echo $URL."?mod=".$val["Numero"]; ?>">
mod</A>
</td>
</tr>
<? $i++; } ?></table>
</td></tr></table>
</BODY></HTML>
<? mysql_close(); ?> |
Partager