Llevo años utilizando esta paginación y siempre me ha ido del 10. pero con el cambio de version de php, ahora me parecen un monton de errores diciendome que tengo que cambiar a Mysqli, la verdad estoy muy verde y claro, siempre es mejor partir desde un ejemplo.
Me gustaria si alguien me puede lanzar un cable
Código:
function rs()
{
switch (func_num_args())
{
case 1:
$this->_rs = func_get_arg(0);
if(!$this->_rs)
{
return false;
}// Fin If
return true;
break;
default:
return $this->_rs;
break;
}
} // function
function query($query)
{
// Primero modificamos el query para averiguar la cantidad total
// de registros que devuelve el query.
$query_count = preg_replace("/select (.+?) form/", "SELECT COUNT(*) FROM",$query);
if(!$this->rs( @mysql_query($query_count, $this->conn()) ))
{
$this->error("Ocurrió un error al ejecutar el query <i><b>\"$query_count\"</b></i>. La base dijo : <b>".mysql_error()."</b>.");
return false;
}// Fin If
$this->total( mysql_result($this->rs(), 0) );
$this->totalPaginas(ceil($this->total() / $this->porPagina()));
// Comprobamos que no se intenta acceder a una página que no existe.
if( $this->pagina() > $this->totalPaginas() )
{
$this->error("No exite la página ".$this->pagina()." de resutados. Hay solo un total de ".$this->totalPaginas());
return false;
}// Fin If
// Ahora modificamos el Query del usuario, para poder agregarle
// los límites para realizar la paginación
$query .= " LIMIT ".($this->desde()-1).",".$this->porPagina();
if(!$this->rs( @mysql_query($query, $this->conn()) ))
{
$this->error("Ocurrió un error al ejecutar el query \"$query\". La base dijo : ".mysql_error());
return false;
}// Fin If
$this->registros( mysql_num_rows( $this->rs() ));
return true;
} // function
/**
* Retorna un Array asociativo con los datos del siguiente
* registro dentro del Result Set.
*
* @since 26/02/2002 11:21:46 a.m.
* @return
**/
function obtenerArray()
{
return mysql_fetch_array( $this->rs() );
} // function
Gracias de antemano a todos y a todas.