ci sono un po' di errori mi sembra...
mmm vediamo..
Codice PHP:
<?php
function list_data($id){
$id= array();
$seq = array();
$cognome = array();
$comuni = array();
$db = mysql_connect("localhost","root","");
mysql_select_db("Generale", $db);
$query = mysql_query("SELECT a.Id AS aid, b.cognome AS bcognome, b.Comune AS bcomune, b.Seq AS bseq FROM foglio1 AS a JOIN studenti AS b ON a.Id=b.Id WHERE a.Id=$id AND a.Id=b.Id AND a.Seq=b.Seq");
while($myrow = mysql_fetch_array($query)){
$id[] = $myrow['aid'];
$seq[] = $myrow['bseq'];
$cognome[] = $myrow['bcognome'];
$comuni[] = $myrow['bcomune'];
}
return array("id" => $id, "seq" => $seq, "cognome" => $cognome, "comune" => $comuni);
}
function print_data($array){
$html = "";
for($i=0;$i<=count($array['id']);$i++){
$html .= "<tr>
<td align= 'center'>{$array['id'][$i]}</td>
<td align= 'center'>{$array['seq'][$i]}</td>
<td align= 'center'>{$array['cognome'][$i]}</td>
<td align= 'center'>{$array['comune'][$i]}</td>
</tr>";
}
return $html;
}
//utilizzo
$data = list_data($tuo_id);
echo print_data($data);
?>
da quel che ho capito, dimmi se sbaglio... estrai il valore 'Seq' dalla tabella studenti passandogli l'id, poi ricerchi i dati del comune solamente se
- Seq della tabella studenti e Seq della tabella foglio1 sono uguali
- Id della tabella studenti e Id della tabella foglio1 sono uguali
??
se è così dovrebbe andare, guarda se ti restituisce qualche errore...