<?php
$txt = $_POST['txt'];
$username="XXX";
$password="XXX";
$database="XXX";
$b=date('d/m/y');
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die("Impossibile selezionare il database.");
$query="SELECT * FROM oggetti WHERE id_venditore LIKE '%$txt%' ORDER BY venduto DESC";
$risultati=mysql_query($query);
$num=mysql_numrows($risultati);
mysql_close();
$i=0;
while ($i < $num) {
$id=mysql_result($risultati,$i,"id");
$id_venditore=mysql_result($risultati,$i,"id_venditore");
$descrizione=mysql_result($risultati,$i,"descrizione");
$prezzo=mysql_result($risultati,$i,"prezzo");
$quantita=mysql_result($risultati,$i,"quantita");
$percento=mysql_result($risultati,$i,"percento");
$provvigione=mysql_result($risultati,$i,"provvigione");
$rimborso=mysql_result($risultati,$i,"rimborso");
$venduto=mysql_result($risultati,$i,"venduto");
$data_vendita=mysql_result($risultati,$i,"data_vendita");
$pagamento=mysql_result($risultati,$i,"pagamento");
echo "<table align='center' bgcolor='white' border='1' height='' width='900' cellpadding='0' cellspacing='0'>";
echo "<tr>";
echo "<td align='center' width=''><b>id oggetto</b></td>";
echo "<td align='center' width=''><b>id venditore</b></td>";
echo "<td align='center' width=''><b>Descrizione</b></td>";
echo "<td align='center' width=''><b>Prezzo</b></td>";
echo "<td align='center' width=''><b>Quantita'</b></td>";
echo "<td align='center' width=''><b>%</b></td>";
echo "<td align='center' width=''><b>Provvigione</b></td>";
echo "<td align='center' width=''><b>Rimborso</b></td>";
echo "<td align='center' width=''><b>Stato</b></td>";
echo "<td align='center' width=''><b>Data vendita</b></td>";
echo "<td align='center' width=''><b>Pagamento</b></td>";
echo "</tr>";
echo "<td align='center'width=''>$id</td>";
echo "<td align='center'width=''>$id_venditore</td>";
echo "<td align='center'width=''>$descrizione</td>";
echo "<td align='center' width=''>$prezzo euro</td>";
echo "<td align='center' width=''>$quantita</td>";
echo "<td align='center' width=''>$percento %</td>";
echo "<td align='center' width=''>$provvigione euro</td>";
echo "<td align='center' width=''>$rimborso euro</td>";
echo "<td align='center' width=''>$venduto</td>";
echo "<td align='center'width=''>$data_vendita</td>";
echo "<td align='center'width=''>$pagamento</td>";
echo "</table><br>";
$i++;
}
?>
<br>
<table align='center' bgcolor='white' border='0' height='' width='900' cellpadding='0' cellspacing='0'>
<td align='center'><font color='black' size='3'>
Totale oggetti = <?php echo "$num"; ?><br>
Rimborso di oggetti venduti fino al <?php echo $b ?> = <?php QUI CI VORREI LA SOMMA ?> <input text=""></font><br><br>
<font color='black' size='2'>Va allegata ad ogni eventuale precedente lista di oggetti rimborsati.<br><a href='javascript:print();'>stampa </a></font></td></table>