<?php

include("header.php");
include("connessione.php");
echo "<table border=1>";

$sql='select c.cognome,c.nome,b.tipo_pagamento,b.quantita,
		r.data_replica,m.titolo,m.autore,m.regista
from clienti c,biglietti b,repliche r,musical m
where c.cod_cliente=b.cod_cliente
and b.cod_replica=r.cod_replica
and r.cod_musical=m.cod_musical
and c.cod_cliente='.$_SESSION["codcliente"];

$ris=mysqli_query($conn, $sql) or die ("query fallita");

$righe=mysqli_num_rows($ris);

if ($righe==0){
	echo "Non ci sono ancora prenotazioni";
}

while ($riga=mysqli_fetch_array($ris)){

	echo "<tr>
		 <td>".$riga["cognome"]."</td>
		 <td>".$riga["nome"]."</td>
		 <td>".$riga["tipo_pagamento"]."</td>
		 <td>".$riga["quantita"]."</td>
		 <td>".$riga["data_replica"]."</td>
		 <td>".$riga["titolo"]."</td>
		 <td>".$riga["autore"]."</td>
		 <td>".$riga["regista"]."</td></tr>";
}

echo "</table>";
?>