Bonjour,
j'ai un petit soucis, j'ai fait un fichier php pour faire une recherche sur une base de donnée palmares.
J'aimerais pouvoir chercher selon plusieur critère, actuellement je ne peux rechercher que par le nom.
Pourriez-vou m'aider voici mon script:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="fr">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Palmares</title>
<style type="text/css">
<!--
.Style2 {font-family: Arial}
.Style6 {
font-size: 18px;
font-family: Arial;
}
.Style8 {font-family: Arial; font-weight: bold; }
.style18 {font-family: Arial; font-weight: bold; font-size: 12px; }
.style19 {font-family: Arial; font-size: 12px; }
-->
</style>
<form action="
http://www.fssc.ch/Autre/recherchebd.php" method="GET" name="Commande">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" src="Autre/JavaScipts.js">
<!--
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
.style1 {color: #CC0000}
.style2 {font-size: 16px}
.style6 {color: #FFCC33}
.Style8 {font-family: Arial}
-->
</style>
</head>
<body bgcolor="#C0C0C0" link="#008000" vlink="#800080" alink="#FF00FF">
<FORM Method="POST" Action="recherchebd.php">
<span class="style18">Date:
<INPUT type=text size=20 name=date>
<BR>
Magnifestation :
<INPUT type=text size=20 name=magnifestation>
<BR>
Nom :
<INPUT type=text size=20 name=nom>
<BR>
Prénom :
<INPUT type=text size=20 name=prenom>
<BR>
Club :
<INPUT type=text size=10 name=club>
<BR>
Rang </span>:
<INPUT type=text size=20 name=rang><BR>
<input name="submit" type=submit value=Envoyer>
<INPUT type=hidden name=afficher value=ok>
</FORM>
<?php if (isset($_POST['recherche']))
{
// j'affiche au dessus du formulaire
}
else
{
// j'affiche rien au dessus du formulaire
}
// et ici mon formulaire
?>
<?php
// Connexion à la base de données
$link = mysql_connect("mysql", "user***", "****")
or die("Impossible de se connecter : " . mysql_error());
// Sélection de la base de données
mysql_select_db("db****");
// On est connectés, on peut travailler sur la BDD
// On fait une boucle pour lister tout ce que contient la table :
$manifestation = $_POST['manifestation']; // tu dois amener ta variable manifestation par un formulaire, réécris moi si tu veux le code complet
$reponse = mysql_query("SELECT * FROM palmares WHERE nom ='$nom' ");
?>
<?php
while($donnees = mysql_fetch_array($reponse) or die(mysql_error()))
{
$manifestation = $donnees['manifestation'];
$date = $donnees['date'];
$lieu = $donnees['lieu'];
$nom = $donnees['nom'];
$prenom = $donnees['prenom'];
$club = $donnees['club'];
$rang = $donnees['rang'];
$score = $donnees['score'];
$top = $donnees['top'];
$afficher = 'ok'
?>
<HTML>
<table width="1000" border="1">
<tr>
<td width="100"><span class="style18">Date</span></td>
<td width="150"><span class="style18">Manifestation</span></td>
<td width="100"><span class="style18">Lieu</span></td>
<td width="100"><span class="style18">Nom</span></td>
<td width="100"><span class="style18">Prénom</span></td>
<td width="30"><span class="style18">Club</span></td>
<td width="60"><span class="style18">Rang</span></td>
<td width="60"><span class="style18">Score</span></td>
<td width="60"><span class="style18">Top</span></td>
</tr>
<tr>
<td width="100"><span class="style19"><?php echo $date; ?></span></td>
<td width="150"><span class="style19"><?php echo $manifestation; ?></span></td>
<td width="100"><span class="style19"><?php echo $lieu; ?></span></td>
<td width="100"><span class="style19"><?php echo $nom; ?></span></td>
<td width="100"><span class="style19"><?php echo $prenom; ?></span></td>
<td width="30"><span class="style19"><?php echo $club; ?></span></td>
<td width="60"><span class="style19"><?php echo $rang; ?></span></td>
<td width="60"><span class="style19"><?php echo $score; ?></span></td>
<td width="60"><span class="style19"><?php echo $top; ?></span></td>
</tr>
</table>
<tr>
</BODY>
</HTML>
<?php
// On a fini de travailler, on ferme la connexion :
mysql_close ; // Déconnexion de MySQL
Merci d'avance de votre aide
Configuration: Windows XP
Internet Explorer 7.0