Foros del Web » Programando para Internet » PHP »

ayuda codigo

Estas en el tema de ayuda codigo en el foro de PHP en Foros del Web. Hola tengo un problema consigo hacer una busuqeda basada en un numero de criterios X ,el problema es q los resultados se muestran en la ...
  #1 (permalink)  
Antiguo 12/06/2003, 14:53
 
Fecha de Ingreso: junio-2002
Mensajes: 70
Antigüedad: 21 años, 9 meses
Puntos: 0
ayuda codigo

Hola tengo un problema consigo hacer una busuqeda basada en un numero de criterios X ,el problema es q los resultados se muestran en la primera página pero al darle a siguiente pagina me da error o me sale atras. ¿Alguien me puede decir si algo esta mal en este codigo?.Las variables estan `pasadas de otra web por referencia .
Gracias de antemano

Código PHP:
<?
session_register
('$logueado');

if (!
$logueado)
{
header("location: login.php");
}

include(
"incs/funcs.inc.php");
connect();
/*estas variables vienen de archivo serach2.php posteado abajo*/
$query="select * from usuarios as u, images as i where u.id_sexo='$sexo' and u.id_lenguaje='$lenguaje' and u.fuma='$fuma' and u.id_pais='$pais' and u.id_tipo_de_encuentro='$tipo_de_encuentro' and u.edad between '$edad1' and '$edad2' and (u.email=i.email) limit $offset, $resultados";
//$query="select * from usuarios, images where (usuarios.email=images.email) limit $offset, $resultados"; //todos
$rusers=mysql_query($query) or die (mysql_error());

//me das las filas de todos los resultados que cumplen la condicion, para que desaparezca la flecha para ir para adelante cuando no hay mas resultados que mostrar
$qcounter="select * from usuarios as u, images as i where u.id_sexo='$sexo' and u.id_lenguaje='$lenguaje' and u.fuma='$fuma' and u.id_pais='$pais' and u.id_tipo_de_encuentro='$tipo_de_encuentro' and u.edad between '$edad1' and '$edad2' and (u.email=i.email)";
//$qcounter="select * from usuarios, images where (usuarios.email=images.email) limit $offset, $resultados";
$rcounter=mysql_query($qcounter) or die (mysql_error());
$cantidad=mysql_num_rows($rcounter);

?> /*segundo cacho de codigo php*/

<?
if ($cantidad==0)
{
echo 
'<table width="27%" border="0" align="center" cellpadding="0" cellspacing="0" class=TextNormal2>';
echo 
"No se encontraron resultados.";
echo 
'</table>';
}
else
{

?>


<? while ($row=mysql_fetch_array($rusers))
{
?> 
<table width="27%" border="0" align="center" cellpadding="0" cellspacing="0" class=TextNormal>

<tr>
<td width="12"><img src="/img/arr_izq.gif" width="12" height="12"></td>
<td background="/img/arr.gif"><img src="/img/arr.gif" width="3" height="12"></td>
<td width="12"><img src="/img/arr_der.gif" width="12" height="12"></td>

<? if ($chkfoto)
{
?>
<td width="12"><img src="/img/arr_izq.gif" width="12" height="12"></td>
<td background="/img/arr.gif"><img src="/img/arr.gif" width="3" height="12"></td>
<td width="12"><img src="/img/arr_der.gif" width="12" height="12"></td>

<?
}
?> </tr>


<tr>
<td width="12" background="/img/izq.gif"><img src="/img/izq.gif" width="12" height="3"></td>

<td>
<?
echo '<div align="center">';
echo 
"Descripcion: ".$row["descrip"];
$encriptado bin2hex($row["email"]);
?> <form action="show_info.php" method="POST">
<input type="hidden" name="mailcrypted" value="<?echo $encriptado;?>">
<input type="submit" name="Submit" value="Mehr info">
</form>
</div>
</td>

<td width="12" background="/img/der.gif"><img src="/img/der.gif" width="12" height="8"></td>

<? if ($chkfoto)
{
?> <td width="12" background="/img/izq.gif"><img src="/img/izq.gif" width="12" height="3"></td>
<td>

<img src="/users_pics/<?php echo $row["pic_name"];?>">

</td>
<td width="12" background="/img/der.gif"><img src="/img/der.gif" width="12" height="8"></td>

<?
}
?> </tr>


<tr>
<td width="12"><img src="/img/aba_izq.gif" width="12" height="12"></td>
<td background="/img/aba.gif"><img src="/img/aba.gif" width="2" height="12"></td>
<td width="12"><img src="/img/aba_der.gif" width="12" height="12"></td>

<? if ($chkfoto)
{
?> <td width="12"><img src="/img/aba_izq.gif" width="12" height="12"></td>
<td background="/img/aba.gif"><img src="/img/aba.gif" width="2" height="12"></td>
<td width="12"><img src="/img/aba_der.gif" width="12" height="12"></td>
<?
}
?> </tr>

</table>

<? echo "<br>";
}
?> 

<table align="center" bordclass="TextNormal">
<tr>
<td>
<? if (($offset-$resultados)>=0)
?> <a href="do_search.php?offset=<?
if ($chkfoto)
echo 
$offset-$resultados.'&chkfoto=1&resultados='.$resultados;
else
echo 
$offset-$resultados.'&resultados='.$resultados;
?>" class="TextNormal2">Zurück</a>
<? ?>
</td>

<td class="TextNormal2">|</td>

<td>
<? if (($offset+$resultados)<=$cantidad)
{
?> <a href="do_search.php?offset=<?
if ($chkfoto)
echo 
$offset+$resultados.'&chkfoto=1&resultados='.$resultados;
else
echo 
$offset+$resultados.'&resultados='.$resultados;
?>" class="TextNormal2">Weiter</a>
<? }
?>
__________________
Rob
Queridas Islas cies te estan llenando de fuel , ¡¡¡putos políticos de mierda que me las vais a joder(os quería ver nandando en fuel a todos CABRONES¡¡¡

Última edición por Rober1978; 12/06/2003 a las 16:12
  #2 (permalink)  
Antiguo 12/06/2003, 14:59
Avatar de Manoloweb  
Fecha de Ingreso: enero-2002
Ubicación: Monterrey
Mensajes: 2.454
Antigüedad: 22 años, 3 meses
Puntos: 5
Hubiera sido mas sencillo para ti ponerlo como codigo PHP...

(ademas más facil de leer para los demás...
Código PHP:
<?
session_register
('$logueado');

if (!
$logueado)
{
header("location: login.php");
}

include(
"incs/funcs.inc.php");
connect();
/*estas variables vienen de archivo serach2.php posteado abajo*/
$query="select * from usuarios as u, images as i where u.id_sexo='$sexo' and u.id_lenguaje='$lenguaje' and u.fuma='$fuma' and u.id_pais='$pais' and u.id_tipo_de_encuentro='$tipo_de_encuentro' and u.edad between '$edad1' and '$edad2' and (u.email=i.email) limit $offset, $resultados";
//$query="select * from usuarios, images where (usuarios.email=images.email) limit $offset, $resultados"; //todos
$rusers=mysql_query($query) or die (mysql_error());

//me das las filas de todos los resultados que cumplen la condicion, para que desaparezca la flecha para ir para adelante cuando no hay mas resultados que mostrar
$qcounter="select * from usuarios as u, images as i where u.id_sexo='$sexo' and u.id_lenguaje='$lenguaje' and u.fuma='$fuma' and u.id_pais='$pais' and u.id_tipo_de_encuentro='$tipo_de_encuentro' and u.edad between '$edad1' and '$edad2' and (u.email=i.email)";
//$qcounter="select * from usuarios, images where (usuarios.email=images.email) limit $offset, $resultados";
$rcounter=mysql_query($qcounter) or die (mysql_error());
$cantidad=mysql_num_rows($rcounter);

?> /*segundo cacho de codigo php*/

<?
if ($cantidad==0)
{
echo 
'<table width="27%" border="0" align="center" cellpadding="0" cellspacing="0" class=TextNormal2>';
echo 
"No se encontraron resultados.";
echo 
'</table>';
}
else
{

?>


<? while ($row=mysql_fetch_array($rusers))
{
?> 
<table width="27%" border="0" align="center" cellpadding="0" cellspacing="0" class=TextNormal>

<tr>
<td width="12"><img src="/img/arr_izq.gif" width="12" height="12"></td>
<td background="/img/arr.gif"><img src="/img/arr.gif" width="3" height="12"></td>
<td width="12"><img src="/img/arr_der.gif" width="12" height="12"></td>

<? if ($chkfoto)
{
?>
<td width="12"><img src="/img/arr_izq.gif" width="12" height="12"></td>
<td background="/img/arr.gif"><img src="/img/arr.gif" width="3" height="12"></td>
<td width="12"><img src="/img/arr_der.gif" width="12" height="12"></td>

<?
}
?> </tr>


<tr>
<td width="12" background="/img/izq.gif"><img src="/img/izq.gif" width="12" height="3"></td>

<td>
<?
echo '<div align="center">';
echo 
"Descripcion: ".$row["descrip"];
$encriptado bin2hex($row["email"]);
?> <form action="show_info.php" method="POST">
<input type="hidden" name="mailcrypted" value="<?echo $encriptado;?>">
<input type="submit" name="Submit" value="Mehr info">
</form>
</div>
</td>

<td width="12" background="/img/der.gif"><img src="/img/der.gif" width="12" height="8"></td>

<? if ($chkfoto)
{
?> <td width="12" background="/img/izq.gif"><img src="/img/izq.gif" width="12" height="3"></td>
<td>

<img src="/users_pics/<?php echo $row["pic_name"];?>">

</td>
<td width="12" background="/img/der.gif"><img src="/img/der.gif" width="12" height="8"></td>

<?
}
?> </tr>


<tr>
<td width="12"><img src="/img/aba_izq.gif" width="12" height="12"></td>
<td background="/img/aba.gif"><img src="/img/aba.gif" width="2" height="12"></td>
<td width="12"><img src="/img/aba_der.gif" width="12" height="12"></td>

<? if ($chkfoto)
{
?> <td width="12"><img src="/img/aba_izq.gif" width="12" height="12"></td>
<td background="/img/aba.gif"><img src="/img/aba.gif" width="2" height="12"></td>
<td width="12"><img src="/img/aba_der.gif" width="12" height="12"></td>
<?
}
?> </tr>

</table>

<? echo "<br>";
}
?> 

<table align="center" bordclass="TextNormal">
<tr>
<td>
<? if (($offset-$resultados)>=0)
?> <a href="do_search.php?offset=<?
if ($chkfoto)
echo 
$offset-$resultados.'&chkfoto=1&resultados='.$resultados;
else
echo 
$offset-$resultados.'&resultados='.$resultados;
?>" class="TextNormal2">Zurück</a>
<? ?>
</td>

<td class="TextNormal2">|</td>

<td>
<? if (($offset+$resultados)<=$cantidad)
{
?> <a href="do_search.php?offset=<?
if ($chkfoto)
echo 
$offset+$resultados.'&chkfoto=1&resultados='.$resultados;
else
echo 
$offset+$resultados.'&resultados='.$resultados;
?>" class="TextNormal2">Weiter</a>
<? }
?>
__________________
Manoloweb
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:03.