Da forma que você colocou deu certinho... Só inclui umas coisas aqui e ali e pronto... deu certo!
na tabela jogos o clubem_cod e clubev_cod, vc ta gravando o cod_cl da tabela clubes?
Isso mesmo... clubem_cod e clubev_cod grava o cod_cl da tabela clubes.
Se quiser dar uma olhada --- CLICA AQUI
O exemplo 1 é o meu (o da dúvida) o exemplo 2 é o seu código, só que deu uma pequena alterada e inclui algumas coisas...
<link href="/lec.css" rel="stylesheet" type="text/css">
<table width="580" border="0" align="center" cellspacing="1" summary="">
<tr bordercolor="#CCCCCC" bgcolor="#0099FF" class="fonte">
<td width="20" align="center"><font color="#FFFFFF"><strong>Campeonato</strong></font></td>
<td width="80" align="center"><font color="#FFFFFF"><strong>Mandante</strong></font></td>
<td width="155" align="center"><font color="#FFFFFF"><strong>Resultado</strong></font></td>
<td width="50" align="center"><font color="#FFFFFF"><strong>Placar</strong></font></td>
<td width="155" align="center"><font color="#FFFFFF"><strong>Resultado</strong></font></td>
<td width="130" align="center"><font color="#FFFFFF"><strong>Visitante</strong></font></td>
</tr>
<?php
$host = "localhost";
$user = "xxxxxxxxxxx_xxx";
$pass = "xxxxxxx";
$db = "xxxxxxx_xxxxxxxxxxxx";
$cor1="#F3F3F3";
$cor2="#E9E9E9";
$cor=$cor1 or $cor2;
mysql_connect($host,$user,$pass) or die ("Impossivel Conectar ao Servidor MySQL");
mysql_select_db($db) or die ("Impossivel Abrir Database");
$sql = "SELECT * FROM jogos ORDER BY cod_jg DESC";
$resultadodapesquisa = mysql_query($sql)
or die ("Não foi possível realizar a consulta ao banco de dados");
while ($linha=mysql_fetch_array($resultadodapesquisa)) {
$cod_jg = $linha["cod_jg"];
$data = $linha["data"];
$camp_cod = $linha["camp_cod"];
$clubem_cod = $linha["clubem_cod"];
$resultadom = $linha["resultadom"];
$resultadov = $linha["resultadov"];
$clubev_cod = $linha["clubev_cod"];
if($cor===$cor1){
$cor=$cor2;
}else{
$cor=$cor1;
}
//aí tu continua fazendo data, resultadom, resultadov, etc
//==============================================
//aí vc faz outra busca na tabela clubes pelo cod do time mandante:
//==============================================
$sqlcm = "SELECT * FROM clubes where cod_cl='$clubem_cod'";
$resultadodapesquisacm = mysql_query($sqlcm)
or die ("Não foi possível realizar a consulta ao banco de dados");
while ($linha2=mysql_fetch_array($resultadodapesquisacm)) {
$clubemandante = $linha2['clube'];
}
//==============================================
//aí vc faz outra busca na tabela clubes pelo cod do time visitante:
//==============================================
$sqlcv = "SELECT * FROM clubes where cod_cl='$clubev_cod'";
$resultadodapesquisacv = mysql_query($sqlcv)
or die ("Não foi possível realizar a consulta ao banco de dados");
while ($linha2=mysql_fetch_array($resultadodapesquisacv)) {
$clubevisitante = $linha2['clube'];
}
//==============================================
//aí vc faz outra busca na tabela campeonatos pelo cod do campeonato:
//==============================================
$sqlc = "SELECT * FROM campeonatos where cod_camp='$camp_cod'";
$resultadodapesquisac = mysql_query($sqlc)
or die ("Não foi possível realizar a consulta ao banco de dados");
while ($linha2=mysql_fetch_array($resultadodapesquisac)) {
$campeonato = $linha2['campeonato'];
}
?>
<tr class="fonte">
<td width="20" align="center"bgcolor="<?php echo"$cor";?>"><?php echo"$campeonato";?><br />
</td>
<td width="80" align="center"bgcolor="<?php echo"$cor";?>" ><?php echo "$clubemandante";?></td>
<td width="155" align="right"bgcolor="<?php echo"$cor";?>" ><?php echo "$resultadom";?>
</td>
<td width="50" align="center"bgcolor="<?php echo"$cor";?>" ><?php echo "<a href=\"fichatecnica.php?id=$id\">$r_mandante x $r_visitante</a>";?></td>
<td width="155" align="left"bgcolor="<?php echo"$cor";?>" ><?php echo "$resultadov";?></td>
<td width="130"bgcolor="<?php echo"$cor";?>" ><?php echo "$clubevisitante";?></td>
</tr>
<?php }?>
</table>



Postagens
Não informado
