Ho due tabelle strutturate in questo modo:
tabella Assegn
id, id_schede, stato
tabela scheda
id, nome
Dovrei fare una query sulla tabella Assegn e recuperare solo i record dove stato='1' ed dall'id_scheda recuperare i record nome da tabella schede.
Eppure se ho dei record nel campo stato uguale a 1 non mi crea nessun elenco nella tabella.Codice PHP:
$ris = mysql_query("SELECT * FROM schede,Assegn WHERE schede.id=Assegn.id_schede")
or die(mysql_error());
echo "<table border='5'>";
echo "<tr> <th>Nome scheda</th> <th>---</th> <th>---</th> <th>Stato</th> <th>---</th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $ris )) {
$id=$row['id'];
$stato=$row['stato'];
if ($row['stato'] =='1'){ //se stato è uguale a 1 allora mostra il nome della scheda
echo "<tr><td>".$row['nome']."</td><td> </td><td> </td>";
}
else{ //altrimenti esci
exit();
}
Dove sbaglio?