Sql / php

Fermé
drogba7213 Messages postés 1524 Date d'inscription mardi 14 août 2007 Statut Membre Dernière intervention 3 avril 2010 - 30 nov. 2008 à 21:09
drogba7213 Messages postés 1524 Date d'inscription mardi 14 août 2007 Statut Membre Dernière intervention 3 avril 2010 - 1 déc. 2008 à 16:46
Bonjour,

Me voici dans de beau drap
je vous explique mon mcd avec un mld

Compte_utilisateur (login,mdp,licence)
cp = login
ce = licence qui reference Personnes.licence

Personnes(licence,nom,prenom,naissance,num_club,classement,s­­exe,mail,licence_jouer)
cp = licence
ce = licence_jouer qui reference personnes.licence

Tournoi (intitule,type,surface,date_début,date_fin,tournoi remporte)
cp = intitule

Matchs (num_resultat,intitule,date,resultat,classement,score_1_set,­­score_2_set,score_3_set,tour,format,durée,format,wo)
cp = num_resultat
ce = intitule qui reference Tournoi.intitule

Participer (intitulé,licence)
cp = (licence,intitulé)
ce = licence qui reference Tournoi.intitulé
ce = licence qui reference Personnes.licence

j'espere ne pas avoir fait d'erreur dans mon mld

j'essaye de faire une requete vérifiant quelle tournoi à insérer une personne et une deuxième requete vérifiant quel match à insérer une personne

pour la première qui est fait en php

je fait

"SELECT * FROM TOURNOI T, PARTICIPER PA, PERSONNES PE WHERE T.INTITULE = PA.INTITULE AND PA.LICENCE = PE.LICENCE AND PE.NOM = '".addslashes($nom)."' AND PE.PRENOM = '".addslashes($prenom)."'"

et la seconde

"SELECT * FROM MATCHS M, TOURNOI T, PARTICIPER PA, PERSONNES PE WHERE M.INTITULE =T.INTITULE AND T.INTITULE = PA.INTITULE AND PA.LICENCE = PE.LICENCE AND PE.NOM = '".addslashes($nom)."' AND PE.PRENOM = '".addslashes($prenom)."'"

mais je ne pensepas qu'elle soit correct elle ne me renvoie rien pouvez vous me dire si elle sont correct ou non et si non me les corriger svp


merci beaucoup d'avance
bonne soirée
A voir également:

5 réponses

Alain_42 Messages postés 5361 Date d'inscription dimanche 3 février 2008 Statut Membre Dernière intervention 13 février 2017 894
30 nov. 2008 à 21:30
Bonsoir,

je pense qu'il faut respecter la casse entre les noms de tables et de champ qd tu cree ta base et dans tes requêtes

"SELECT * FROM Tournoi T, Participer Pa, Personnes Pe WHERE T.intitule = Pa.intitule AND Pa.licence = Pe.licence AND Pe.nom = '".addslashes($nom)."' AND Pe.prenom = '".addslashes($prenom)."'"


idem pour l'autre
0
drogba7213 Messages postés 1524 Date d'inscription mardi 14 août 2007 Statut Membre Dernière intervention 3 avril 2010 21
30 nov. 2008 à 22:13
justement la casse est respecté il sont enregistré en majuscule dans la base

jvoulai savoir si ma requete renvoie bien ce que je veut surtout sinon ca veut dire que c'est une de mes conditions dans mon code danslaquelle je ne rentre pas

si c'est e cas est ce que je purais vous faire mon code?
0
drogba7213 Messages postés 1524 Date d'inscription mardi 14 août 2007 Statut Membre Dernière intervention 3 avril 2010 21
1 déc. 2008 à 13:14
up
0
Alain_42 Messages postés 5361 Date d'inscription dimanche 3 février 2008 Statut Membre Dernière intervention 13 février 2017 894
1 déc. 2008 à 14:02
le mieux pour verifier c'est de faire un essai
0
Archeus01 Messages postés 1571 Date d'inscription mercredi 3 octobre 2007 Statut Membre Dernière intervention 9 juin 2022 452 > Alain_42 Messages postés 5361 Date d'inscription dimanche 3 février 2008 Statut Membre Dernière intervention 13 février 2017
1 déc. 2008 à 14:19
+1 essaye de faire un essai directement avec PHPmyadmin ou n'importe quel autre logiciel du même type... qui te permet d'effectuer directemetn t requete php
0
drogba7213 Messages postés 1524 Date d'inscription mardi 14 août 2007 Statut Membre Dernière intervention 3 avril 2010 21
1 déc. 2008 à 14:08
lol l'essai est fait si je post sur le forum c'est que je suis bloqué en fait donc jvais mettre mon code vous medites si vous voulez des explication
merci d'avance

<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<link rel="stylesheet" media="screen" type="text/css" title="Design" href="style5.css" />
<title></title>
</head>
<body>
<div id="underlinemenu">
<ul>
<li><a href="nouveau_result_class.html" title="Nouveau_résultat">Nouveau résultat</a></li>
<li><a href="resultat.php" title="Palmarès">Palmarès</a></li>
<li><a href="simulation.html" title="Simulation">Simulation</a></li>
<li><a href="stat_class.html" title="Statistiques">Statistiques</a></li>
<li><a href="export_class.html" title="Export">Export</a></li>
</ul>
</div>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<?php

include("connect.php");

//Mise en forme et présentation de base

$login=$_SESSION['login'];

$sql = "SELECT NOM FROM PERSONNES P, COMPTE_UTILISATEUR C WHERE P.LICENCE = C.LICENCE AND C.LOGIN = '".addslashes($login)."'";
$req = mysql_query($sql) or die('Erreur SQL : <br />'.$sql);
$result = mysql_fetch_row($req);
$_SESSION['nom'] = $result[0];

$sql1 = "SELECT PRENOM FROM PERSONNES P, COMPTE_UTILISATEUR C WHERE P.LICENCE = C.LICENCE AND C.LOGIN = '".addslashes($login)."'";
$req1 = mysql_query($sql1) or die('Erreur SQL : <br />'.$sql1);
$result2 = mysql_fetch_row($req1);
$_SESSION['prenom'] = $result2[0];

echo $_SESSION['prenom'] . " " . $_SESSION['nom'] . "<br />" . "<br />";
echo 'PALMARES : '. date('Y') ."<br>"."<br>"."<br>";

//début du code pour la présentation des résultats

if (isset ($_POST['title']) && isset ($_POST['type']) )
{
$title = $_POST['title'];
$type = $_POST['type'];
$surface = $_POST['surface'];
$datedeb = $_POST['dateStartYear']."-".$_POST['dateStartMonth']."-".$_POST['dateStartDay'];
$datefin = $_POST['dateEndYear']."-".$_POST['dateEndMonth']."-".$_POST['dateEndDay'];


if (($_POST['win'])=='1')
{
$win = 'oui';
}
else
{
$win = 'non';
}
$requete1 = "insert into TOURNOI (`INTITULE`, `TYPE`, `SURFACE`, `DATE_DÉBUT`, `DATE_FIN`, `TOURNOI_REMPORTE`) values('$title','$type','$surface','$datedeb','$datefin','$win')";
mysql_query($requete1);

//requête pour insérer les tuples dans PARTICIPER
$req_array1 = mysql_query('SELECT LICENCE FROM PERSONNES');
$personnes = mysql_fetch_array($req_array1);
$personnes_licence = $personnes['LICENCE'];

//insertion des clés étrangères dans PARTICIPER
$requete2 = "insert into PARTICIPER (`INTITULE`, `LICENCE`) values('$title','$personnes_licence')";
mysql_query($requete2);
}

//mise en forme du tableau tournoi
$nom = $_SESSION['nom'];
$prenom = $_SESSION['prenom'];
$req_array2 = mysql_query("SELECT * FROM TOURNOI T, PARTICIPER PA, PERSONNES PE WHERE T.INTITULE = PA.INTITULE AND PA.LICENCE = PE.LICENCE AND PE.NOM = '".addslashes($nom)."' AND PE.PRENOM = '".addslashes($prenom)."'");
while ($epreuves = mysql_fetch_array($req_array2))
{?>
<table style="text-align: left; width: 966px; height: 32px;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="background-color: rgb(192, 192, 192);"><span
style="color: rgb(255, 255, 255);"><?php
echo "<b>".$epreuves['INTITULE']." - Du ".$epreuves['DATE_DÉBUT']." au ".$epreuves['DATE_FIN']. " - ".$epreuves['SURFACE']."</b>"."<br>";
if ($epreuves['TOURNOI_REMPORTE']=='oui')
{
echo "Tournoi remporté";
}
?><span
style="font-weight: bold;"></span></span></td>
</tr>
</tbody>
</table>
<table style="text-align: left; width: 966px; height: 32px;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<?php
}
$eprId = $_POST['eprId'];
$dateresult = $_POST['dateYear']."-".$_POST['dateMonth']."-".$_POST['dateDay'];
$result = $_POST['result'];
$wo = $_POST['wo'];
$advClt = $_POST['advClt'];
$scoreSet1a = $_POST['scoreSet1a'];
$scoreSet1b = $_POST['scoreSet1b'];
$scoreSet2a = $_POST['scoreSet2a'];
$scoreSet2b = $_POST['scoreSet2b'];
$scoreSet3a = $_POST['scoreSet3a'];
$scoreSet3b = $_POST['scoreSet3b'];
$tour = $_POST['tour'];
$surface = $_POST['surface'];
$indoor = $_POST['indoor'];
$chpt = $_POST['chpt'];
$format = $_POST['format'];
$time = $_POST['time'];
$licence = $_POST['licence'];
$advLastName = $_POST['advLastName'];
$advFirstName = $_POST['advFirstName'];
$advNais = $_POST['advNais'];
$advClub = $_POST['advClub'];

//insertion dans la table matchs
if (isset ($_POST['eprId']) && isset ($_POST['result']) && isset ($_POST['advClt']) )
{
include("connect.php");

if ($indoor=='0' && $wo=='0' && $result=='D')
{
$indoor = 'extérieur';
$wo = 'wo';
$result = 'défaite';
}
else
{
$indoor = 'intérieur';
$wo = 'non';
$result = 'victoire';
}
$requete1 = "insert into MATCHS (`NUM_RESULTAT`, `INTITULE`, `DATE`, `RESULTAT`, `CLASSEMENT`, `SCORE_1_SET`, `SCORE_2_SET`, `SCORE_3_SET`, `TOUR`, `FORMAT`, `DURÉE`, `INDOOR`, `WO`) values('','$eprId','$dateresult','$result','$advClt','$scoreSet1a / $scoreSet1b','$scoreSet2a / $scoreSet2b','$scoreSet3a / $scoreSet3b','$tour','$format','$time','$indoor','$wo')";
mysql_query($requete1);
$requete2 = "insert into PERSONNES (`LICENCE`, `LICENCE_JOUER`, `NOM`, `PRENOM`, `NAISSANCE`, `NUM_CLUB`, `CLASSEMENT`, `SEXE`, `MAIL`) values('$licence','','$advLastName','$advFirstName','$advNais','$advClub','$advClt','','')";
mysql_query($requete2);
}

//mise en forme des résultats

$req_array3 = mysql_query("SELECT * FROM MATCHS M, TOURNOI T, PARTICIPER PA, PERSONNES PE WHERE M.INTITULE =T.INTITULE AND T.INTITULE = PA.INTITULE AND PA.LICENCE = PE.LICENCE AND PE.NOM = '".addslashes($nom)."' AND PE.PRENOM = '".addslashes($prenom)."'");
while ($matchs = mysql_fetch_array($req_array3))
{
if ($matchs['NUM_RESULTAT']='' && $matchs['INTITULE']='' && $matchs['RESULTAT']='' && $matchs['CLASSEMENT']='')
{?>
<tr>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Date</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Tour</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Adversaire</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Clt</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Score</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Licence</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Club</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Age</td>
</tr><tr>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Aucun résultat</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"></td>
</tr>
</tbody>
</table>
<?php
}
else
{
?>
<table style="text-align: left; width: 966px; height: 32px;"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Date</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Tour</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Adversaire</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Clt</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Score</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Licence</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Club</td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;">Age</td>
</tr>
<tr>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"><?php echo $matchs['DATE']?></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"><?php echo $matchs['TOUR']?></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"><?php echo $personnes['NOM']. " ".$personnes['PRENOM']?></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"><?php echo $matchs['CLASSEMENT']?></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"><?php echo $matchs['SCORE_1_SET']. " " .$matchs['SCORE_2_SET']. " ".$matchs['SCORE_3_SET']?></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"><?php echo $personnes['LICENCE']?></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"><?php echo $personnes['NUM_CLUB']?></td>
<td
style="text-align: center; background-color: rgb(205, 205, 205); color: rgb(51, 51, 255); font-weight: bold;"><?php echo date("Y") -$personnes['NAISSANCE']?></td>
</tr>
</tbody>
</table>
<?php
}
}
?>

</body>
</html>
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
drogba7213 Messages postés 1524 Date d'inscription mardi 14 août 2007 Statut Membre Dernière intervention 3 avril 2010 21
1 déc. 2008 à 16:46
avez vous eu le temp de jeter un oeuil au code svp?
0