Ver Mensaje Individual
  #1 (permalink)  
Antiguo 22/11/2008, 11:37
Avatar de Wilfred
Wilfred
 
Fecha de Ingreso: octubre-2008
Mensajes: 110
Antigüedad: 16 años, 3 meses
Puntos: 1
Paginator error

Buenas,
Utilicé el paginador php y sql de jpinedo en un sistema de noticias.El error es el siguente:

Error en la consulta de conteo de registros: Resource id #5. Mysql dijo: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #5' at line 1

y aquí mi script,usando el ejemplo del autor:
Código:
<?php

// verificamos si se ha enviado
// alguna variable via GET
if(isset($_GET['id']) && $_GET['categoria']){
    // asignamos los valores
    // a las variables que usaremos
    $cat_ID = $_GET['id'];
    $categoria = $_GET['categoria'];
    $clausula = "WHERE notCategoriaID = '$cat_ID'";
    // tambien armamos el titular de la pagina
    $titulo = "Noticias en la categoria $categoria";
}else{
    // de lo contrario
    // el titulo sera general
    $titulo = "Todas las noticias";
}
// armamos la consulta
  include('admin/db-cnx.php');
$_pagi_sql = mysql_query("SELECT *, notTitulo, notTexto,fecha,DATE_FORMAT(fecha,'%d-%m-%y ') AS fecha FROM sn_noticias ORDER BY not_ID DESC  
                            $clausula ", $db_link)
                            or die(mysql_error);
$_pagi_cuantos = 2;
include("paginator.inc.php");


//echo "<h1>$titulo</h1>";
// mostramos las noticias,
// otra vez usanod un bucle while
while($rowNot = mysql_fetch_array($_pagi_sql)){


    echo "<h1>$rowNot[notTitulo]</h1>";
	 echo substr($rowNot['notTexto'], 0, 500);
   
    echo "<center><br><a href=ver.php?id=$rowNot[not_ID]>Seguir leyendo...</a><br></center>" ;
	
	echo "<span class='Estilo4'>Escrito el: </span><span class='Estilo5'>$rowNot[fecha]</span>";
	

	
}
echo"<p>".$_pagi_navegacion."</p>";

?>
Gracias por la ayuda