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

mira um aver esto hise aver fijate si esta vien: en los archivos:
add-noticia.php
Código PHP:
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>
<body>
<?php
// incluimos el archivo de conexion
include ('db-cnx.php');

// recibimos el formulario
if(isset($_POST['enviar']) && $_POST['enviar'] == 'Enviar'){
    
// comprobamos que el formulario no envie campos vacios
    
if(!empty($_POST['notTitulo']) && $_POST['notTexto'] && $_POST['notFoto'] && 
    
$_POST['notCategoriaID']){
        
// creamos las variables y les asignamos los valores a insertar
        
$notTitulo = $_POST['notTitulo'];
        
$notFoto = $_POST['notFoto'];
        
$notTexto = $_POST['notTexto'];
        
$notCategoriaID = $_POST['notCategoriaID'];
        
// hacemos el INSERT en la BD
        
$_pagi_sql = "INSERT INTO sn_noticias
                                     (notTitulo, notFoto, notTexto, notCategoriaID)
                                     VALUES ('$notTitulo', '$notFoto', '$notTexto', '$notCategoriaID')"
;   
        
$sqlInsertNot = mysql_query($_pagi_sql , $db_link) or die(mysql_error());
        
// enviamos un mensaje de exito
        
echo "Los datos fueron gurdados correctamente";
    }else{
        
// si el formulario envia algun campo vacio
        // enviamos un mensaje de error
        
echo "Debe llenar todos los campos del formulario";
    }
}
?>
<?php 
if (isset($_SESSION['s_username'])) { 
include (
'fornot.php'); 
}else{ 
echo 
"<DIV align=center class='Estilo28'>BIENVENIDO(A): VISITANTE, GRACIAS POR VISITARNOS, TE INVITAMOS A LOGUEARTE O REGISTRATE</DIV>";
}
?>

</body>
</html>
y en list-noticia.php
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 = "INSERT INTO sn_noticias
                                     (notTitulo, notFoto, notTexto, notCategoriaID)
                                     VALUES ('$notTitulo', '$notFoto', '$notTexto', '$notCategoriaID')"
;  
$_pagi_cuantos = 10;

//Incluimos el script de paginación. Éste ya ejecuta la consulta automáticamente
include("paginator.inc.php");
 
        
$sqlInsertNot = mysql_query($_pagi_sql , $db_link) or die(mysql_error());
echo 
"<h1>$titulo</h1>";
// 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>";

?>
y me sale ese error lo puedes ver en:
http://buscaxtremo.com/prueba/noticias.php


Código PHP:
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