Tableau a générer...

cs_cy4nur3 Messages postés 17 Date d'inscription mardi 3 mai 2005 Statut Membre Dernière intervention 27 mai 2010 - 19 mai 2010 à 12:34
cs_cy4nur3 Messages postés 17 Date d'inscription mardi 3 mai 2005 Statut Membre Dernière intervention 27 mai 2010 - 19 mai 2010 à 13:47
Bonjour tout le monde.

Je rencontre un soucis avec un tableau. que je dois générer et qui m'alimenter une base.

CREATE TABLE IF NOT EXISTS `inscription` (
  `inscription_id` int(10) NOT NULL AUTO_INCREMENT,
  `num_appariement` int(10) DEFAULT NULL,
  `tournois_id` int(10) DEFAULT NULL,
  `joueurs_id` int(10) DEFAULT NULL,
  `joueurs_classement` int(10) DEFAULT NULL,
  PRIMARY KEY (`inscription_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;


CREATE TABLE IF NOT EXISTS `match` (
  `match_id` int(10) NOT NULL AUTO_INCREMENT,
  `n_ronde` int(10) DEFAULT NULL,
  `joueur_1` varchar(50) DEFAULT NULL,
  `joueur_2` varchar(50) DEFAULT NULL,
  `couleur_j1` varchar(10) DEFAULT NULL,
  `couleur_j2` varchar(50) DEFAULT NULL,
  `table` int(5) DEFAULT NULL,
  `point_j1` int(10) DEFAULT NULL,
  `point_j2` int(10) DEFAULT NULL,
  `tournois_id` int(10) DEFAULT NULL,
  PRIMARY KEY (`match_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;



Les joueurs arrive un N° d'appariement, on la coupe en deux et on veut faire jouer chaque tete de liste contre l'autre et ainsi de suite pour chaque joueur.

Exemple: pour un tournois de 36 joueurs, on verra le 1er match 1 contre 19,2 contre 20 .. etc jusqu'à 18 contre 36

voici le contenu de la table inscription :

inscription_id num_appariement tournois_id joueurs_id joueurs_classement
1______________1 1 1 2850
3______________2 1 8 2007
2______________3 1 7 750
4______________4 1 10 602

2 réponses

cs_cy4nur3 Messages postés 17 Date d'inscription mardi 3 mai 2005 Statut Membre Dernière intervention 27 mai 2010
19 mai 2010 à 12:44
Message incomplé, je me suis trompé de bouton... sorry

Je rencontre un soucis avec un tableau. que je dois générer et qui m'alimenter une base.


CREATE TABLE IF NOT EXISTS `inscription` (
  `inscription_id` int(10) NOT NULL AUTO_INCREMENT,
  `num_appariement` int(10) DEFAULT NULL,
  `tournois_id` int(10) DEFAULT NULL,
  `joueurs_id` int(10) DEFAULT NULL,
  `joueurs_classement` int(10) DEFAULT NULL,
  PRIMARY KEY (`inscription_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;




CREATE TABLE IF NOT EXISTS `match` (
  `match_id` int(10) NOT NULL AUTO_INCREMENT,
  `n_ronde` int(10) DEFAULT NULL,
  `joueur_1` varchar(50) DEFAULT NULL,
  `joueur_2` varchar(50) DEFAULT NULL,
  `couleur_j1` varchar(10) DEFAULT NULL,
  `couleur_j2` varchar(50) DEFAULT NULL,
  `table` int(5) DEFAULT NULL,
  `point_j1` int(10) DEFAULT NULL,
  `point_j2` int(10) DEFAULT NULL,
  `tournois_id` int(10) DEFAULT NULL,
  PRIMARY KEY (`match_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;




Les joueurs arrive un N° d'appariement, on la coupe en deux et on veut faire jouer chaque tete de liste contre l'autre et ainsi de suite pour chaque joueur.

Exemple: pour un tournois de 36 joueurs, on verra le 1er match 1 contre 19,2 contre 20 .. etc jusqu'à 18 contre 36

voici le contenu de la table inscription :

inscription_id num_appariement tournois_id joueurs_id joueurs_classement
1______________1_______________1___________1__________2850
3______________2_______________1___________8__________2007
2______________3_______________1___________7__________750
4______________4_______________1___________10_________602

Dans un premier temps il faut que j'affiche un tableau:

Joueur1________Contre_________Joueur2
1_____________________________3
2_____________________________4

Voici ce que j'ai deja fait mais la je bloque un peu:

$requete1 "SELECT count( `num_appariement` ) AS nb_joueurs FROM `inscription` WHERE `tournois_id`1";
$result1 = mysql_query($requete1);
while ($resultat = mysql_fetch_row($result1))
{
$nombre=$resultat[0];
}
echo $nombre;

$result_nbr=$nombre/2;

print("<table width='500' border='1'>
<tr>
<td align='center'>Joueur 1</td>
<td align='center'>Num Appariement</td>
<td align='center'>Joueur 2</td>
<td align='center'>Num Appariement</td>
</tr>");
0
cs_cy4nur3 Messages postés 17 Date d'inscription mardi 3 mai 2005 Statut Membre Dernière intervention 27 mai 2010
19 mai 2010 à 13:47
SELECT `joueurs_id`,`num_appariement`
FROM `inscription`
where `num_appariement` <=2

SELECT `joueurs_id`,`num_appariement`
FROM `inscription`
where `num_appariement` >2

voila ce que je viens de trouver mais en fait il me faudrait ca mais sur le meme tableau , le resultat a coté de l'autre et non en dessous.
0
Rejoignez-nous