Double requete en PHP
auremax
Messages postés
14
Statut
Membre
-
auremax Messages postés 14 Statut Membre -
auremax Messages postés 14 Statut Membre -
Bonjour,
je desirerais faire deux demande sur une page PHP, je m'explique j'ai un moteur de recher dans ma bas de donné, jusque là tout va bien mais en dessous j'aurais aimer mettre la liste de toute ma base de donné, c'est là que je but car j'ai beau essayer de mettre une autre requête mais rien y fait.
Auriez-vous une solution pour moi, je suis très débutante je vous met 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; }
.style20 {
font-size: 16px;
color: #003399;
}
.style21 {color: #000000}
.style22 {font-family: Arial; font-weight: bold; font-size: 12px; color: #000000; }
-->
</style>
<form action="https://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>
</HTML>
<HTML>
<head>
<title>Palmarès</title>
</head>
</HTML>
<body bgcolor="#C0C0C0" link="#008000" vlink="#800080" alink="#FFFFFF">
<div align="left">
<table border="0" width="90%" cellspacing="20" cellpadding="0" height="65">
<tr>
<td width="100%" align="center" valign="top" height="25"><font color="#000080"><font face="Arial" size="4"><strong>Palmares</strong></font><a name="haut"></a></font></td>
</tr>
</table>
<body bgcolor="#C0C0C0" link="#008000" vlink="#800080" alink="#FF00FF">
<hr>
<FORM Method="POST" Action="recherchebd.php">
<p class="Style2 style20"><span class="style22">Date:
<input name="date" type="text" size="20">
(indiqué AAAA-MM-JJ) <BR>
Lieu :
<INPUT type=text size=20 name=lieu>
<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><span class="style21">:</span>
<INPUT type=text size=20 name=rang>
<BR>
<input name="submit" type=submit value=Envoyer>
<INPUT type=hidden name=afficher value=ok>
</p>
</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", "user08283", "ooudooth1")
or die("Impossible de se connecter : " . mysql_error());
// Sélection de la base de données
mysql_select_db("db0828301");
// 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 date ='$date' OR lieu ='$lieu' OR nom ='$nom' OR prenom ='$prenom' OR club ='$club' OR categorie ='$categorie' OR serie ='$serie' OR rang ='$rang'");
?>
<HTML>
<BODY>
<table width="1000" border="1">
<tr>
<td width="70"><span class="style18">Date</span></td>
<td width="180"><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">Catégorie</span></td>
<td width="30"><span class="style18">Série</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>
</table>
<?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'];
$categorie = $donnees['categorie'];
$serie = $donnees['serie'];
$rang = $donnees['rang'];
$score = $donnees['score'];
$top = $donnees['top'];
$afficher = 'ok'
?>
<table width="1000" border="1">
<tr>
<td width="70"><span class="style19"><?php echo $date; ?></span></td>
<td width="180"><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 $categorie; ?></span></td>
<td width="30"><span class="style19"><?php echo $serie; ?></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>
</BODY>
</HTML>
<HTML>
<BODY>
<?php
$reponse = mysql_query("SELECT * FROM palmares WHERE date ='$date' ORDER BY date");
?>
<table width="1000" border="1">
<tr>
<td width="70"><span class="style18">Date</span></td>
<td width="180"><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">Catégorie</span></td>
<td width="30"><span class="style18">Série</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>
</table>
<?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'];
$categorie = $donnees['categorie'];
$serie = $donnees['serie'];
$rang = $donnees['rang'];
$score = $donnees['score'];
$top = $donnees['top'];
$afficher = 'ok'
?>
<table width="1000" border="1">
<tr>
<td width="70"><span class="style19"><?php echo $date; ?></span></td>
<td width="180"><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 $categorie; ?></span></td>
<td width="30"><span class="style19"><?php echo $serie; ?></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>
<?php
// On a fini de travailler, on ferme la connexion :
mysql_close ; // Déconnexion de MySQL
?>
<?php
echo $message;
}
?>
</BODY>
</HTML>
^
Merci pour votre aide
je desirerais faire deux demande sur une page PHP, je m'explique j'ai un moteur de recher dans ma bas de donné, jusque là tout va bien mais en dessous j'aurais aimer mettre la liste de toute ma base de donné, c'est là que je but car j'ai beau essayer de mettre une autre requête mais rien y fait.
Auriez-vous une solution pour moi, je suis très débutante je vous met 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; }
.style20 {
font-size: 16px;
color: #003399;
}
.style21 {color: #000000}
.style22 {font-family: Arial; font-weight: bold; font-size: 12px; color: #000000; }
-->
</style>
<form action="https://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>
</HTML>
<HTML>
<head>
<title>Palmarès</title>
</head>
</HTML>
<body bgcolor="#C0C0C0" link="#008000" vlink="#800080" alink="#FFFFFF">
<div align="left">
<table border="0" width="90%" cellspacing="20" cellpadding="0" height="65">
<tr>
<td width="100%" align="center" valign="top" height="25"><font color="#000080"><font face="Arial" size="4"><strong>Palmares</strong></font><a name="haut"></a></font></td>
</tr>
</table>
<body bgcolor="#C0C0C0" link="#008000" vlink="#800080" alink="#FF00FF">
<hr>
<FORM Method="POST" Action="recherchebd.php">
<p class="Style2 style20"><span class="style22">Date:
<input name="date" type="text" size="20">
(indiqué AAAA-MM-JJ) <BR>
Lieu :
<INPUT type=text size=20 name=lieu>
<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><span class="style21">:</span>
<INPUT type=text size=20 name=rang>
<BR>
<input name="submit" type=submit value=Envoyer>
<INPUT type=hidden name=afficher value=ok>
</p>
</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", "user08283", "ooudooth1")
or die("Impossible de se connecter : " . mysql_error());
// Sélection de la base de données
mysql_select_db("db0828301");
// 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 date ='$date' OR lieu ='$lieu' OR nom ='$nom' OR prenom ='$prenom' OR club ='$club' OR categorie ='$categorie' OR serie ='$serie' OR rang ='$rang'");
?>
<HTML>
<BODY>
<table width="1000" border="1">
<tr>
<td width="70"><span class="style18">Date</span></td>
<td width="180"><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">Catégorie</span></td>
<td width="30"><span class="style18">Série</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>
</table>
<?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'];
$categorie = $donnees['categorie'];
$serie = $donnees['serie'];
$rang = $donnees['rang'];
$score = $donnees['score'];
$top = $donnees['top'];
$afficher = 'ok'
?>
<table width="1000" border="1">
<tr>
<td width="70"><span class="style19"><?php echo $date; ?></span></td>
<td width="180"><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 $categorie; ?></span></td>
<td width="30"><span class="style19"><?php echo $serie; ?></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>
</BODY>
</HTML>
<HTML>
<BODY>
<?php
$reponse = mysql_query("SELECT * FROM palmares WHERE date ='$date' ORDER BY date");
?>
<table width="1000" border="1">
<tr>
<td width="70"><span class="style18">Date</span></td>
<td width="180"><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">Catégorie</span></td>
<td width="30"><span class="style18">Série</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>
</table>
<?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'];
$categorie = $donnees['categorie'];
$serie = $donnees['serie'];
$rang = $donnees['rang'];
$score = $donnees['score'];
$top = $donnees['top'];
$afficher = 'ok'
?>
<table width="1000" border="1">
<tr>
<td width="70"><span class="style19"><?php echo $date; ?></span></td>
<td width="180"><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 $categorie; ?></span></td>
<td width="30"><span class="style19"><?php echo $serie; ?></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>
<?php
// On a fini de travailler, on ferme la connexion :
mysql_close ; // Déconnexion de MySQL
?>
<?php
echo $message;
}
?>
</BODY>
</HTML>
^
Merci pour votre aide
A voir également:
- Double requete en PHP
- Double ecran - Guide
- Whatsapp double sim - Guide
- Double driver - Télécharger - Pilotes & Matériel
- Double appel - Guide
- Double boot - Guide