Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/05/2008, 22:08
Avatar de hernansam
hernansam
 
Fecha de Ingreso: septiembre-2007
Ubicación: Funes , Argentina
Mensajes: 204
Antigüedad: 16 años, 8 meses
Puntos: 0
problema de while en sist. de noticia

Hola termine de hacer un sistema de comentarios pero me aparece este error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\hernan\sistema\index.php on line 8

Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\hernan\sistema\index.php on line 18

Procesar noticia
Código PHP:
<?php
$link 
mysql_connect("localhost""root""pass") or die("No se pudo conectar al servidor");

mysql_select_db("noticias"$link) or die("No se pudo conectar a la DB");

$titulo $_POST['titulo'];
$contenido $_POST['contenido'];
$fecha date("Y-m-d");


mysql_query("INSERT INTO noticias (titulo, contenido, fecha) VALUES ('$titulo','$contenido', '$fecha');"$link);

if(!
mysql_error()) { 
    
header("location: index.php"); exit();
} else { 
    echo 
mysql_error();
}
?>
index
Código PHP:
<?php
$link 
mysql_connect("localhost","root","pass");

mysql_select_db("noticias",$link);

$resultado mysql_query("SELECT * FROM contenidos ORDER BY id DESC;"$link);

while(
$datos mysql_fetch_array($resultado))
{
?>
<h2>$datos['titulo']</h2>
<br />
<p>$datos['contenido']</p>
<br /><div>$datos['fecha']
<a href=ver.php?id=$datos['id']>Comentarios</a>
<?
}//este es el cierre del while
mysql_free_result($resultado);
?>