0
I wish to introduce 3 players who are from the same team but for that I want only the name of the team to appear once.
$query = "SELECT distinct nometeam from jogador";
$dados = mysqli_query($conn, $query) or die(mysql_error());
$linha = mysqli_fetch_assoc($dados);
$total = mysqli_num_rows($dados);
?>
<center>
<table class = "tabela" style="width:100%" border="0" bgcolor="white" style="text-align:center;">
<tr>
<td allign = 'left'><b> Nome da Equipa </b></td>
<td allign = 'center'><b> Nome do Jogador </b></td>
<td allign = 'center' colspan = '3'><b> Pontuação do Jogador </b></td>
</tr>
<?php
if($total){ do {
$query1 = "SELECT * from `jogador`, `pontos` WHERE `nometeam` = '".$linha['nometeam']."'" ;
$dados1 = mysqli_query($conn, $query1);
$linha1 = mysqli_fetch_array($dados1);
?>
<tr>
<td><?php echo $linha['nometeam'] ?></td>
<td><?php echo $linha1['nome'] ?><td>
<td><?php echo $linha1['pontos'] ?></td>
</tr>
<?php
}while($linha = mysqli_fetch_assoc($dados));}
?>
</table>
</center>
</body>
</html>
it becomes very difficult to help without knowing the structure of the tables or seeing an example of data
– Ricardo Pontual
ok. Player - codj, name, team name, datanasc, emai, contact, gender. The dice are same test data
– ATXtreme
I suggest you remove css from the question, and focus on the problem that will be related to php and/or database
– Isac
css is an aesthetic part of the site
– ATXtreme
Yes I know, but there are more things in the question that end up filling up and "distracting" those who try to understand their problem. The same applies to labels
<title>
among others. The more you can minimize your question to what really matters the better. This here in our network has a name that is a Minimum, complete and verifiable example of the problem– Isac
You can see now, I minimized what I got
– ATXtreme
tries to group by team name, for example:
select nometeam, nome from jogador, pontos WHERE nometeam = '".$linha['nometeam']."' group by nometeam, nome"
– Ricardo Pontual
If the team name is a column in the table, how exactly do you want to display only once? It would only be in the first row of the 3?
– Woss
What I need is to be introduced 3 players per 1 team
– ATXtreme