Ver Mensaje Individual
  #20 (permalink)  
Antiguo 08/10/2008, 14:24
jeankex
 
Fecha de Ingreso: agosto-2008
Mensajes: 102
Antigüedad: 15 años, 8 meses
Puntos: 0
Respuesta: Mostrar datos de la base de datos

bueno en el archivo:
list-noticia.php puse lo que me dijiste:
Código PHP:
<?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
$_pagi_sql "SELECT notTitulo, notFoto, notTexto FROM sn_noticias
                            $clausula ORDER by not_ID DESC"
;   

$sqlQueryNot mysql_query($_pagi_sql $db_link)
                            or die(
mysql_error);
echo 
"<h1>$titulo</h1>";

//cantidad de resultados por página (opcional, por defecto 20)
$_pagi_cuantos 10;

//Incluimos el script de paginación. Éste ya ejecuta la consulta automáticamente
include("paginator.inc.php");


// mostramos las noticias,
// otra vez usanod un bucle while
while($rowNot mysql_fetch_array($sqlQueryNot)){
    echo 
"<h1>$rowNot[notTitulo]</h1>";
    echo 
"<table cellspacing='0' cellpadding='0' width='448' 
            background='anuncios/bg_anuncio.jpg' 
            border='0' >
  <tr>
    <td valign='top' ><table cellspacing='0' cellpadding='0' width='100%' border='0'>
      <tbody>
        <tr>
          <td width='448'  valign='middle'><img src='anuncios/header.jpg' alt='ANUNCIA GRATIS EN BUSCAXTREMO - Y OBTEN 100% DE RENTABILIDAD' width='448' height='30' /></td>
        </tr>
      </tbody>
    </table></td>
  </tr>
  <tr>
    <td width='448' valign='top' background='anuncios/bg_anuncio.jpg'><table width='448' border='0'>
      <tr>
        <td width='135' valign='top'><img src='$rowNot[notFoto]' width='135' height='135' /></td>
        <td width='303' valign='top'><div align='justify'>$rowNot[notTexto]</div></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td width='448' valign='top'><img src='anuncios/footer.jpg' width='448' height='15' /></td>
  </tr>
</table>"
;
}
echo
"<p>".$_pagi_navegacion."</p>";

?>
puedes ver el error que me arroja:
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /home/buscaxtr/public_html/prueba/paginator.inc.php on line 208
Error en la consulta limitada: INSERT INTO sn_noticias (notTitulo, notFoto, notTexto, notCategoriaID) VALUES ('', '', '', '') LIMIT 0,10. 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 'LIMIT 0,10' at line 3