Salve...
Ho un problemino.
Ho due tabelle su un DB:
1. tabellaSquadre: dati tecnici specifici (nome, cognome, etc..)
2. tabellaPartite: tabella incontri (id_squ_casa, id_squ_fuori, etc...)
Vorrei stampare, dentro una tabella tutti i match.
Questo è lo script che eseguo:
<?
$matchnumber = mysql_query("SELECT * FROM tabellaPartite");
$num_rows = mysql_num_rows($matchnumber);
$start = 1;
for ($start=1; $start<$num_rows+1; $start++)
{
$sql = "SELECT * FROM tabellaPartite WHERE (tabellaPartite.division = 1 AND tabellaPartite.girone = 2)";
$open = mysql_query($sql);
while($rs = mysql_fetch_array($open))
{
$id = $rs["id_par"];
$id_squ_c = $rs["id_squ_c"];
$id_squ_f = $rs["id_squ_f"];
$division = $rs["division"];
$girone = $rs["girone"];
$round = $rs["round"];
$data = $rs["data"];
$ora = $rs["ora"];
}
$sql2 = "SELECT * FROM tabellaSquadre WHERE id_squ = ".$id_squ_c;
$open2 = mysql_query($sql2);
while($rs2 = mysql_fetch_array($open2))
{
$squ_casa = $rs2["nome_squ"];
$venue = $rs["venue"];
}
$sql2 = "SELECT * FROM tabellaSquadre WHERE id_squ = ".$id_squ_f;
$open2 = mysql_query($sql2);
while($rs2 = mysql_fetch_array($open2))
{
$squ_fuori = $rs2["nome_squ"];
}
$partita = $squ_casa." - ".$squ_fuori;
?>
<tr>
<td class="tabletd"><? print($arr_Division[$division]) ?></td>
<td class="tabletd"><? print($arr_Gironi[$girone]) ?></td>
<td class="tabletd"><? print($data) ?>
<? print($ora) ?></td>
<td class="tabletd"><? print($venue) ?></td>
<td class="tabletd"><? print($partita) ?></td>
<td class="tabletd">result</td>
</tr>
<?
}
?>
Il problema è che lo script non va in errore ma mi stampa due volte il primo record della tabella.
Qualcuno sa dirmi dove sbaglio???