Foros del Web » Programando para Internet » PHP »

no me imprime la noticia en el sistema de noticia

Estas en el tema de no me imprime la noticia en el sistema de noticia en el foro de PHP en Foros del Web. Hola , ya hace tiempo que tengo un problema con este sistema de noticias me sale este error en el index del sistema de noticias ...
  #1 (permalink)  
Antiguo 21/04/2008, 23:55
Avatar de hernansam  
Fecha de Ingreso: septiembre-2007
Ubicación: Funes , Argentina
Mensajes: 204
Antigüedad: 16 años, 7 meses
Puntos: 0
no me imprime la noticia en el sistema de noticia

Hola , ya hace tiempo que tengo un problema con este sistema de noticias me sale este error en el index del sistema de noticias ,alguien sabe porque puede ser
Unknown column 'articulo' in 'field list'

Código HTML:
<!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>escribir noticia</title>
</head>


<body><form action="procesarnoticia.php" method="post">
Título noticia:<br>
<input type="text" name="titulo"><br>
Autor:<br>
<input type="text" name="autor"><br>
Categoría:<br>
<input type="text" name="categoria"><br>
Escriba el articulo<br>
<textarea name="articulo" cols="50" rows="10"></textarea><br>
<input type="submit" value="Publicar"><br>
</form>
</body>
</html> 
donde proceso la noticia
Código PHP:
<?php
  $connect 
mysql_connect("localhost""root""pass");

mysql_select_db("sistemadenoticias"$connect);

$titulo mysql_real_escape_string($_POST['titulo']);
$autor mysql_real_escape_string($_POST['autor']);
$categoria mysql_real_escape_string($_POST['categoria']);
$articulo mysql_real_escape_string($_POST['articulo']);



mysql_query("insert into noticias(titulo,autor,categoria,articulo,fecha) values ('$titulo','$autor','$categoria','$articulo',NOW())"$connect);

    if (!
mysql_error()) { 
    
header("location: index.php"); die;
    }
        else { 
        echo 
mysql_error();
        }
?>
el index donde debe imprimir la noticia
Código PHP:
<?php
$connect
=mysql_connect("localhost","root","pass");

mysql_select_db("sistemadenoticias",$connect);

$result=mysql_query("select * from noticias order by fecha Desc"$connect);
echo 
mysql_error();

$totalregistros=mysql_num_rows($result);

while(
$row=mysql_fetch_array($result))
{
echo 
"<h2>".$row[titulo]."</h2><br><p>".$row[articulo]."</p><br><div>".$row[autor]."|".$row[fecha]."| ".$row[categoria]."|
<a href=ver.php?id="
.$row[id_noticia].">comentarios()</a> |
<a href=editar.php?id="
.$row[id_noticia].">editar</a></div>";
}
mysql_free_result($result)
?>
  #2 (permalink)  
Antiguo 22/04/2008, 00:07
Avatar de eddwinpaz  
Fecha de Ingreso: noviembre-2007
Ubicación: Merida , Venezuela
Mensajes: 1.066
Antigüedad: 16 años, 6 meses
Puntos: 25
Re: no me imprime la noticia en el sistema de noticia

debes ponerle comillas simples a el arreglo ejemplo.
$row['titulo'];

y verifica que tengas noticias almacenadas en tu base de datos.
__________________
O nos hacemos miserables o nos hacemos fuertes , la cantidad de trabajo es la misma.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 15:21.