Hello,
I've created kind of a query by example form passing the variables of the query from a form to a the page with the query, but, I don't know how to add the navigation buttons to the results page (prev/next page). This is the code I already have for the result page:
<?
$sqlhostname = "localhost";
$login = "xxxxxx";
$password = "xxxxxx";
$base = "xxxxxx";
$db_connect = mysql_connect($sqlhostname,$login,$password);
$base_selection = mysql_select_db($base,$db_connect);
$query = "SELECT documental.Id,
documental.Titulo,
documental.Abstract,
documental.Fecha,
documental.Fecha_Act,
documental.Link,
documental.Contenido,
documental.Autor,
documental.Cetegoria,
documental.keyword,
documental.documento
FROM documental WHERE
(
(
(documental.Cetegoria like '$categoria')
and
(documental.$campo $clausula1 '$condicion1')
)
) ORDER BY documental.$orden LIMIT 0, $numero";
$req = mysql_query($query);
if (!$req)
{ echo "<B>Error ".mysql_errno()." :</B> ".mysql_error()."";
exit; }
$res = mysql_num_rows($req);
if ($res == 0)
{ echo "<center><br><br><br><br><b>No se han encontrado registros coincidentes con sus parametros de busqueda.</b></center>";}
else
echo"<p align=right><a href='javascript:history.back()'>Nueva Busqueda</a> </p>
<center>
<b>Su búsqueda en la categoría </b><font color=ff0000>$categoria </font> <b> de </b><font color=ff0000> $campo $clausula1 $condicion1 </font><b>ha devuelto</b><font color=ff0000 size=2><b> $res</b> </font><B>resultados</b><br><br>
<table cellspacing=1 bgcolor=ffffff width='75%'>
<TR><td bgcolor=ffcc33><font color=000000>Id</td><td bgcolor=ffcc33><font color=000000>Titulo</td>
<td bgcolor=ffcc33><font color=000000>Abstract</td><td bgcolor=ffcc33><font color=000000>Fecha</td>
<td bgcolor=ffcc33><font color=000000>Autor</td><td bgcolor=ffcc33><font color=000000>Categoria</td>
<td bgcolor=ffcc33><font color=000000>Tipo Documento</td>
</TR>";
{ while($row = mysql_fetch_array($req))
{
extract($row);
echo"
<tr><td bgcolor=006699>
$Id</td>
<td bgcolor=003366>
<a href='ficha2.phtml?Id=$Id'>$Titulo</A></td>
<td bgcolor=006699>
$Abstract</td>
<td bgcolor=003366>
$Fecha</td>
<td bgcolor=003366>
$Autor</td>
<td bgcolor=003366>
$Cetegoria</td>
<td bgcolor=003366>
$documento</td></tr>
";
}
}
echo"</table></center>";
?>
This code is working fine.
Please can anyone help me to put those navigation buttons??
Thanks in advance
Andres