ti posto tutto il codice:
[code]
<?php
$dbhost = "localhost";
$dbusername = "root";
$dbuserpass = "";
$dbname = "iscrizione";
mysql_connect ($dbhost, $dbusername, $dbuserpass);
if (!mysql_select_db($dbname)) die(mysql_error());
$sesso=$_POST["sesso"];
$anni=$_POST["anni"];
$citta=$_POST["citta"];
$stato=$_POST["stato"];
$capelli=$_POST["capelli"];
$occhi=$_POST["occhi"];
$first_name=$_POST["first_name"];
$username=$_POST["username"];
$nomei=$_POST["nomei"];
$sql= "SELECT * FROM utenti";
if($sesso){
$find=substr_count($filtro, "WHERE");
if($find !=0){
$filtro.=" AND sesso='$sesso' ";
}else{
$filtro="WHERE sesso='$sesso' "; }
}
if($anni){
$find=substr_count($filtro, "WHERE");
if($find !=0){
$filtro.=" AND anni='$anni' ";
}else{
$filtro="WHERE anni='$anni' "; }
}
if($citta){
$find=substr_count($filtro, "WHERE");
if($find !=0){
$filtro.=" AND citta='$citta' ";
}else{
$filtro="WHERE citta='citta' "; }
}
if($stato){
$find=substr_count($filtro, "WHERE");
if($find !=0){
$filtro.=" AND stato='$stato' ";
}else{
$filtro="WHERE stato='stato' "; }
}
if($capelli){
$find=substr_count($filtro, "WHERE");
if($find !=0){
$filtro.=" AND capelli='$capelli' ";
}else{
$filtro="WHERE capelli='capelli' "; }
}
if($occhi){
$find=substr_count($filtro, "WHERE");
if($find !=0){
$filtro.=" AND occhi='$occhi' ";
}else{
$filtro="WHERE occhi='occhi' "; }
}
if($first_name){
$find=substr_count($filtro, "WHERE");
if($find !=0){
$filtro.=" AND first_name='$firstname' ";
}else{
$filtro="WHERE first_name='first_name' "; }
}
if($username){
$find=substr_count($filtro, "WHERE");
if($find !=0){
$filtro.=" AND username='$username' ";
}else{
$filtro="WHERE username='username' "; }
}
if($nomei){
$find=substr_count($filtro, "WHERE");
if($find !=0){
$filtro.=" AND nomei='$nomei' ";
}else{
$filtro="WHERE nomei='nomei' "; }
}
$sql .= $filtro."ORDER BY first_name";
$query = mysql_query ($sql) or die (mysql_error().$sql);
while ($valori = mysql_fetch_array ($query)){
echo "Nome: ".$valori ['first_name'];
echo "Username: ".$valori ['username'];
echo "Sesso: ".$valori ['sesso'];
echo "Anni: ".$valori ['anni'];
echo "Città: ".$valori ['citta'];
echo "Stato: ".$valori ['stato'];
echo "Capelli: ".$valori ['capelli'];
echo "Occhi: ".$valori ['occhi'];
echo "Immagine: [img]/images/$nomei[/img]";
}
?>


Rispondi quotando