Nella mia pagina di ricerca utenti dovrebbe, se non seleziono nessun parametro di ricerca, restituirmi tutti gli utenti nel database, invece me ne restituisce 3, e non capisco nemmeno con che criterio, visto che variano da utente che fa la ricerca a utente...
Ecco il codice:
Qualche aiuto? Grazie infinite in anticipo 
Edit: risolto, ho risolto, scusate
Ecco il codice:
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<?php session_start();
?>
<HTML>
<HEAD>
<TITLE>Results</TITLE><link href="style.css" rel="stylesheet" type="text/css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY>
<div align="center">
<TABLE class="maintable" CELLPADDING="0" CELLSPACING="0" summary="">
<TR>
<TD COLSPAN=3> <IMG SRC="http://forum.mrwebmaster.it/images/index_01.gif" WIDTH=727 HEIGHT=240 ALT=""></TD>
</TR>
<TR> </div>
<TD ROWSPAN=2 class="navbg" valign="top"><div id="nav">
<p><span class="h2">Menu</span> <a href="index.php">Home</a> <a href="rules.php">Rules</a>
<a href="gallery.php">Gallery</a> <a href="upload.php">Upload</a> <a href="search.php">Search</a>
</p>
<?php
if ((isset($_SESSION['login']))&&((isset($_SESSION['password'])))){
echo <<<print
<p><span class="h2">Logout</span> <a href="profile.php">Your Profile</a> <a href="logout.php">Logout</a><span class="endbox"></span> </p>
<p><span class="h2">Friendship</span> <a href="users.php">Search user</a> <a href="friend.php">My friends</a> <a href="request.php">Friends request</a> <span class="endbox"></span> </p>
print;
}
else {
echo <<<print
<p><span class="h2">Sign in</span> <a href="create.html">Create account</a> <a href="login.htm">Login</a><span class="endbox"></span></p>
print;
}
?>
<?php
include("connessione.inc");
if (isset($_SESSION['login'])) {
$login = $_SESSION['login'];
$sqlA="SELECT Nickname FROM utenti WHERE Nickname = '$login' AND Admin = '1'";
$resA=mysql_query($sqlA,$conn)or die("Error!".mysql_error());
$lines=mysql_num_rows($resA);
if ($lines == 1){
echo <<<print
<p><span class="h2">Admin</span> <a href="admin.php">Administration</a><span class="endbox"></span></p>
print;
}
}
echo <<<print
</p>
</div></TD>
<TD ROWSPAN=2 class="contentbg" valign="top"><div id="content">
print;
?>
<h1>Results</h1>
<?php
include("connessione.inc");
$conta=0;
$user= $_SESSION ['login'];
$sql= "SELECT IDutente from utenti WHERE Nickname = '$user'";
$res=mysql_query($sql,$conn)or die("Error!".mysql_error());
while ($records=mysql_fetch_assoc($res)) {
$IDutente=$records['IDutente'];
}
if (isset($_GET['search'])){
$search=$_GET['search'];
}
else {
$search = "WHERE utenti.IDutente != '$IDutente' ";
}
if (isset ($_POST['nickname'])!= '') {
$nickname = addslashes(htmlentities($_POST['nickname']));
$search = $search."and Nickname LIKE '%".$nickname."%' ";
}
if (isset ($_POST['name'])!= '') {
$name = addslashes(htmlentities($_POST['name']));
$search = $search."and Name LIKE '%".$name."%' ";
}
if (isset ($_POST['surname'])!= '') {
$surname = addslashes(htmlentities($_POST['surname']));
$search = $search."and Surname LIKE '%".$surname."%' ";
}
if (isset ($_POST['place'])!= '') {
$place = addslashes(htmlentities($_POST['place']));
$search = $search."and LuogoNascita LIKE '%".$place."%' ";
}
if (isset ($_POST['sketch'])!= '') {
$conta++;
$interest1 = addslashes(htmlentities($_POST['sketch']));
$search = $search."and Interesse1 LIKE '%".$interest1."%' ";
}
if (isset ($_POST['art'])!= '') {
$conta++;
$interest2 = ($_POST['art']);
$search = $search."and Interesse2 LIKE '%".$interest2."%' ";
}
if (isset ($_POST['painting'])!= '') {
$conta++;
$interest3 = ($_POST['painting']);
$search = $search."and Interesse3 LIKE '%".$interest3."%' ";
}
if (isset ($_POST['music'])!= '') {
$conta++;
$interest4 = ($_POST['music']);
$search = $search."and Interesse4 LIKE '%".$interest4."%' ";
}
if (isset ($_POST['games'])!= '') {
$conta++;
$interest5 = ($_POST['games']);
$search = $search."and Interesse5 LIKE '%".$interest5."%' ";
}
if (isset ($_POST['book'])!= '') {
$conta++;
$interest6 = ($_POST['book']);
$search = $search."and Interesse6 LIKE '%".$interest6."%' ";
}
if (isset ($_POST['photography'])!= '') {
$conta++;
$interest7 = ($_POST['photography']);
$search = $search."and Interesse7 LIKE '%".$interest7."%' ";
}
if (isset ($_POST['film'])!= '') {
$conta++;
$interest8 = ($_POST['film']);
$search = $search."and Interesse8 LIKE '%".$interest8."%' ";
}
if (isset ($_POST['other'])!= '') {
$conta++;
$interest9 = ($_POST['other']);
$search = $search."and Interesse9 LIKE '%".$interest9."%' ";
}
$sql="SELECT * FROM (utenti) $search";
$res=mysql_query($sql,$conn)or die("Error!".mysql_error());
$lines=mysql_num_rows($res);
if ($lines == 0){
echo "There isn't user with this parameters!";
}
else {
$recordperpagina=3;//numero di record per pagina
$numeropagine=ceil($lines / $recordperpagina);
if (isset ($_GET['page'])){
$paginacorrente = $_GET['page'];
}
else {
$paginacorrente = 1;
}
$primolimit = ($paginacorrente - 1)* $recordperpagina;
$sql="SELECT * FROM (utenti) $search ORDER BY utenti.Nickname LIMIT $primolimit, $recordperpagina";
$res=mysql_query($sql,$conn)or die("Error!".mysql_error());
while ($records=mysql_fetch_assoc($res)) {
$nickname=$records['Nickname'];
$name=$records['Name'];
$surname=$records['Surname'];
$address=$records['Address'];
$email=$records['Email'];
$telephone=$records['Telephone'];
$place=$records['LuogoNascita'];
$date=$records['DataNascita'];
$int1=$records['Interesse1'];
$int2=$records['Interesse2'];
$int3=$records['Interesse3'];
$int4=$records['Interesse4'];
$int5=$records['Interesse5'];
$int6=$records['Interesse6'];
$int7=$records['Interesse7'];
$int8=$records['Interesse8'];
$int9=$records['Interesse9'];
$ID=$records['IDutente'];
$sqlC="SELECT Nickname FROM utenti WHERE Nickname = '$login' AND Admin = '1'";
$resC=mysql_query($sqlC,$conn)or die("Error!".mysql_error());
$lines=mysql_num_rows($resC);
if ($lines == 1){
echo <<<MESS
<table summary="lista" id="lista" border="1" cellpadding="4">
<tr>
<th id="nickLista" colspan="2"><a href="profile1.php?ID=$ID&nickname=$nickname&name=$name&surname=$surname&address=$address&email=$email&telephone=$telephone&place=$place&date=$date&int1=$int1&int2=$int2&int3=$int3&int4=$int4&int5=$int5&int6=$int6&int7=$int7&int8=$int8&int9=$int9">$nickname</a></br> <a href="deleteUser.php?ID=$ID">Delete User</a></th>
</tr><tr>
<td><em>Name</em>:</td><td>$name</td></tr>
<tr>
<td><em>Surname:</em></td><td>$surname</td></tr>
<tr>
<td><em>Address:</em></td><td>$address</td></tr>
<tr>
<td><em>Email:</em></td><td>$email</td></tr>
<tr>
<td><em>Telephone:</em></td><td>$telephone</td></tr>
<tr>
<td><em>Place:</em></td><td>$place</td></tr>
<tr>
<td><em>Date of Birth:</em></td><td>$date</td></tr>
<tr>
<td><em>Interests:</em></td><td>$int1 $int2 $int3 $int4 $int5 $int6 $int7 $int8 $int9</td></tr>
<td colspan="2" align="center">
<a href="request1.php?ID=$ID">Add to friends</a>
</td>
</tr>
</table></br>
MESS;
}
else{
echo <<<MESS
<table summary="lista" id="lista" border="1" cellpadding="4">
<tr>
<th id="nickLista" colspan="2"><a href="profile1.php?ID=$ID&nickname=$nickname&name=$name&surname=$surname&address=$address&email=$email&telephone=$telephone&place=$place&date=$date&int1=$int1&int2=$int2&int3=$int3&int4=$int4&int5=$int5&int6=$int6&int7=$int7&int8=$int8&int9=$int9">$nickname</a></br></th>
</tr><tr>
<td><em>Name</em>:</td><td>$name</td></tr>
<tr>
<td><em>Surname:</em></td><td>$surname</td></tr>
<tr>
<td><em>Address:</em></td><td>$address</td></tr>
<tr>
<td><em>Email:</em></td><td>$email</td></tr>
<tr>
<td><em>Telephone:</em></td><td>$telephone</td></tr>
<tr>
<td><em>Place:</em></td><td>$place</td></tr>
<tr>
<td><em>Date of Birth:</em></td><td>$date</td></tr>
<tr>
<td><em>Interests:</em></td><td>$int1 $int2 $int3 $int4 $int5 $int6 $int7 $int8 $int9</td></tr>
<td colspan="2" align="center">
<a href="request1.php?ID=$ID">Add to friends</a>
</td>
</tr>
</table></br>
MESS;
}
}
if ($paginacorrente == 1){
$precedente = "";
}
else {
$previous_page = ($paginacorrente - 1);
$precedente = "<a href=\"?page=$previous_page&search=$search\" title=\"Go to the previous page\" id=\"previus\"><<-- previous</a>";
}
if($paginacorrente == $numeropagine){
$successiva = "";
}
else {
$next_page = ($paginacorrente + 1);
$successiva = "<a href=\"?page=$next_page&search=$search\" title=\"Go to the next page\" id=\"next\">next -->></a>";
}
echo "$precedente <p id=\"paginacorrente\">Pagina $paginacorrente di $numeropagine </p> $successiva";
}
?>
</br>
</br>
</br>
</br>
<h1>©SketchMania</h1>
<TD valign="top" class="spacer"></TD>
</TR><TR>
<TD height="2" class="spacer2"></TD>
</TR><TR>
<TD COLSPAN=3 class="creditsbg">
<p>| Contact us <a href="http://yahoo.com/" target="_blank">sketchmania@yahoo.com</a> | </p>
</TD>
</TR>
</TABLE>
</div>
</BODY>
</HTML>

Edit: risolto, ho risolto, scusate

Ultima modifica: