<?php
include 'conf.php';
$b=date('Y');
session_start();
if ($_SESSION['username']==$usern) ;
else{
header("Location: login.htm");
}
{ ?>
<head>
<title>Cerca</title>
</head>
<?php
include 'body.php';
$sel = $_POST['sel'];
$txt = $_POST['txt'];
?>
<a name='inizio'></a>
<table align="center" border="0" height="" width="100%" cellpadding="0" cellspacing="0">
<form align='center' action='cerca.php?reg=1' method='POST'>
<p align="left"><font color="black" size="5">
<b>Gestione dati</b></font>
<select style='color:black;background-color:#33FF33;' name="sel">
<option value="id">Cerca per id</option>
<option value="id_venditore">Cerca per id venditore</option>
<option value="venduto_a">Cerca per id acquirente</option>
<option value="cognome">Cerca per cognome cliente</option>
<option value="nome">Cerca per nome cliente</option>
<option value="data">Cerca per data registrazione record</option>
<option value="venduto">Cerca per in vendita/venduto</option>
<option value="reso_venditore">Cerca per reso al venditore</option>
<option value="pagamento">Cerca per rimborsato</option>
<option value="reso_compratore">Cerca per reso dal compratore</option>
<option value="rottamato">Cerca per rottamato</option>
<option value="descrizione">Cerca per descrizione oggetto</option>
<option value="categoria">Categoria</option>
<option value="scadenza_oggetto">Scadenza oggetto</option>
<option value="prezzo">Cerca per prezzo</option>
<option value="email">Cerca per email</option>
<option value="telefono">Cerca per telefono</option>
</select>
<input type='text' name='txt' value='%'></option><input style='color:black;background-color:#33FF33;' type='submit' value='Avvia ricerca'>
</form> <br>
<a href="#fondo"><input style='color:white;background-color:blue;' type='submit' value='statistiche'></a>
<?php
echo "<form align='center' action='eti2.php?reg=1' method='POST' target='_blank'>
Stampa le etichette del cliente numero<input style='color:black;background-color:azure;' type='submit' name='txt' value='$txt' readonly='readonly'>di oggi! </form>\n";
?>
</table>
<?php
include_once ("config.php");
include_once ("connect.php");
mysql_connect(localhost,$DB_user,$DB_password);
@mysql_select_db($DB_name) or die("Impossibile selezionare il database.");
$query="SELECT * FROM `oggetti` WHERE `$sel` LIKE CONVERT ( _utf8 '$txt' USING latin1 ) ORDER BY id DESC";
$risultati=mysql_query($query);
$num=mysql_numrows($risultati); <----------è la riga 70. se tolgo questa riga,non ho più errori. Ma non funziona lo script...
$i=0;
while ($i < $num) {
$id=mysql_result($risultati,$i,"id");
$data=mysql_result($risultati,$i,"data");
$nome=mysql_result($risultati,$i,"nome");
$cognome=mysql_result($risultati,$i,"cognome");
$indirizzo=mysql_result($risultati,$i,"indirizzo");
$telefono=mysql_result($risultati,$i,"telefono");
$email=mysql_result($risultati,$i,"email");
$descrizione=mysql_result($risultati,$i,"descrizione");
$scadenza_oggetto=mysql_result($risultati,$i,"scadenza_oggetto");
$categoria=mysql_result($risultati,$i,"categoria");
$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");
$id_venditore=mysql_result($risultati,$i,"id_venditore");
$venduto_a=mysql_result($risultati,$i,"venduto_a");
$pagamento=mysql_result($risultati,$i,"pagamento");
$totale_prezzo = $totale_prezzo + $prezzo*$quantita;
$totale_provvigione = $totale_provvigione + $provvigione;
$totale_rimborso = $totale_rimborso + $rimborso;
echo "<table align='center' bgcolor='#E0FFFF' border='1' height='' width='100%' cellpadding='0' cellspacing='0'>";
echo "<tr>";
echo "<td align='center' width=''><font size='1'><b>id</b></td>";
echo "<td align='center' width=''><font size='1'><b>data</b></td>";
echo "<td align='center' width=''><font size='1'><b>nome</b></td>";
echo "<td align='center' width=''><font size='1'><b>cognome</b></td>";
echo "<td align='center' width=''><font size='1'><b>indirizzo</b></td>";
echo "<td align='center' width=''><font size='1'><font size='1'><b>telefono</b></td>";
echo "<td align='center' width=''><font size='1'><b>email</b></td>";
echo "<td align='center' width=''><font size='1'><b>Id venditore</b></td>";
echo "<td align='center' width=''><font size='1'><b>Descrizione</b></td>";
echo "<td align='center' width=''><font size='1'><b>Scadenza</b></td>";
echo "<td align='center' width=''><font size='1'><b>Categoria</b></td>";
echo "<td align='center' width=''><font size='1'><b>Prezzo</b></td>";
echo "<td align='center' width=''><font size='1'><b>Quantita'</b></td>";
echo "<td align='center' width=''><font size='1'><b>%</b></td>";
echo "<td align='center' width=''><font size='1'><b>Provvigione</b></td>";
echo "<td align='center' width=''><font size='1'><b>Rimborso</b></td>";
echo "<td align='center' width=''><font size='1'><b>Venduto a</b></td>";
echo "<td align='center' width=''><font size='1'><b>Pagamento</b></td>";
echo "</tr>";
echo "<td align='center' width=''><a title='MODIFICA RECORD' target='db2' href='modifica.php?mod=$id\' target='db'>
<blink><input style='color:black;background-color:yellow;' type='submit' value='$id'><br></blink></a><form title='RIASSUNTIVO' align='center' action='situazione.php?reg=1' method='POST'><input style='color:black;background-color:#33FF33;' type='submit' name='txt' value='$id' ></td>";
echo "<td align='center' width=''><font size='2'>$data</td>";
echo "<td align='center' width=''><font size='2'>$nome</td>";
echo "<td align='center' width=''><font size='2'>$cognome</td>";
echo "<td align='center' width=''><font size='2'>$indirizzo</td>";
echo "<td align='center' width=''><font size='2'>$telefono</td>";
echo "<td align='center' width=''><font size='2'>$email</td>";
echo "<td align='center' width=''><font size='2'><form align='center' action='situazione.php?reg=1' method='POST'><input style='color:black;background-color:#33FF33;' type='submit' name='txt' value='$id_venditore' title='RIASSUNTIVO'></form></td>";
echo "<td align='center' width=''><font size='2'>$descrizione</td>";
echo "<td align='center' width=''><font size='2'>$scadenza_oggetto</td>";
echo "<td align='center' width=''><font size='2'>$categoria</td>";
echo "<td align='center' width=''><font size='2'>$prezzo</td>";
echo "<td align='center' width=''><font size='2'>$quantita</td>";
echo "<td align='center' width=''><font size='2'>$percento</td>";
echo "<td align='center' width=''><font size='2'>$provvigione</td>";
echo "<td align='center' width=''><font size='2'>$rimborso</td>";
echo "<td align='center' width=''><font size='2'><form align='center' action='situazione.php?reg=1' method='POST'><input style='color:white;background-color:red;' type='submit' name='txt' value='$venduto_a' title='RIASSUNTIVO'></form></td>";
echo "<td align='center' width=''><font size='2'>$pagamento</td>";
echo "</table><br>";
echo "<a href='#inizio'><input style='color:white;background-color:blue;' type='submit' value='up'></a>";
$i++;
}
echo "<table align='center' bgcolor='yellow' border='0' height='' width='100%' cellpadding='0' cellspacing='0'>";
echo "<p align='center'>(Record= $num) (Entrate euro= $totale_prezzo) (Provvigioni euro= $totale_provvigione) (Rimborsi euro= $totale_rimborso)</p>";
echo "<center><a name='fondo'></a></center>";
echo "</table>";
?>
</body>
<? } ?>