Paginador que no pagina - SOS

willy01
11 de Mayo del 2004
Hola: soy nuevo en php y en foro.
Alguien me puede ayudar con este problema:
La primera página la tira bien pero despues manda toda la base sin filtrar.
Gracias mil.


<?
// Set Script Variables
echo "<body bgcolor='#000033'>";
$DB_Host="localhost";
$DB_Name="car";
$DB_User="car";
$DB_Pass="****";
$Per_Page=10;
$_REQUEST['Keyword']="'%$xbus%' or ubic LIKE '%$xbus%' or eng LIKE '%$xbus%' or por LIKE '%$xbus%'";
// Open MySQL Connection
$Connection=mysql_connect($DB_Host, $DB_User, $DB_Pass);
// Run The Query Without a Limit to get Total result
$SQL="SELECT COUNT(*) AS Total FROM BETA WHERE rubro like '%$xbus%' or ubic LIKE '%$xbus%' or eng LIKE '%$xbus%' or por LIKE '%$xbus%'";
$SQL_Result=mysql_db_query($DB_Name, $SQL);
$SQL_Result_Array=mysql_fetch_array($SQL_Result);
$Total=$SQL_Result_Array['Total'];
echo "<table width='600%' border='0'>";
echo "<tr>";
echo "<td bgcolor='#003366'> ";
echo "<font color='#FFFFFF'>Encontrados ";
echo ($Total);
echo" resultados.</font><br>";
echo "</td></tr>";
echo "</table>";
// Create a new SELECT Query with the ORDER BY clause and without the COUNT(*)
$SQL="SELECT * FROM BETA WHERE rubro like '%$xbus%' or ubic LIKE '%$xbus%' or eng LIKE '%$xbus%' or por LIKE '%$xbus%'";
// Append a LIMIT clause to the SQL statement
if (empty($_GET['Result_Set']))
{
$Result_Set=0;
$SQL.=" LIMIT $Result_Set, $Per_Page";
}else
{
$Result_Set=$_GET['Result_Set'];
$SQL.=" LIMIT $Result_Set, $Per_Page";
}
// Run The Query With a Limit to get result
$SQL_Result=mysql_db_query($DB_Name, $SQL);
$SQL_Rows=mysql_num_rows($SQL_Result);
// Display Results using a for loop
for ($a=0; $a < $SQL_Rows; $a++)
{
$SQL_Array=mysql_fetch_array($SQL_Result);
$titulo=$SQL_Array['titulo'];
$rubro=$SQL_Array['rubro'];
$ubic1=$SQL_Array['ubic'];
$ubic='<A HREF="'.$SQL_Array['ubic'].'"> ir/go </A>';
$comentario=$SQL_Array['comentario'];
$ingles=$SQL_Array['eng'];
$portugues=$SQL_Array['por'];
$alta=$SQL_Array['alta'];
echo "<font color='FFCC33'> $titulo<BR>";
echo "<p>$rubro<BR>";
echo "<img src='imagesarg.gif' width='19' height='18'><font color='#FFCC33'>$comentario<br>";
echo "<img src='imagesbra.gif' width='19' height='18'>$portugues<br>";
echo "<img src='imagesusa.gif' width='19' height='18'>$ingles<BR>";
echo "$ubic1<BR>";
echo "$ubic<BR>";
echo "$alta</font><BR></p>";
echo "<table width='600%' border='0'>";
echo "<tr>";
echo "<td bgcolor='#003366'> </td>";
echo "</tr>";
echo "</table>";
}
// Create Next / Prev Links and $Result_Set Value
if ($Total>0)
{
if ($Result_Set<$Total && $Result_Set>0)
{
$Res1=$Result_Set-$Per_Page;
echo "<A HREF="visualis.php?Result_Set=$Res1&xbus=$xbus."<< Previous Page</A> ";
}
// Calculate and Display Page # Links
$Pages=$Total / $Per_Page;
if ($Pages>1)
{
for ($b=0,$c=1; $b < $Pages; $b++,$c++)
{
$Res1=$Per_Page * $b;
echo "<A HREF="visualis.php?Result_Set=$Res1&xbus=$xbus.">$c</A> n";
}
}
if ($Result_Set>=0 && $Result_Set<$Total)
{
$Res1=$Result_Set+$Per_Page;
if ($Res1<$Total)
{
echo " <A HREF="visualis.php?Result_Set=$Res1&xbus=$xbus.">Next Page >></A>";
}
}
}
// Close Database Connection
mysql_close($Connection);
?>