Código PHP:
<?
$mostrar = 5; //Edu aqui pones cuantas noticias mostrara
$host = "localhost";
$user = "";
$pass = "";
$dbname = "portalcdr";
$conecta = mysql_connect($host,$user,$pass);
mysql_select_db($dbname,$conecta);
$query = "select * from noticias order by fecha desc";
$resp = mysql_query($query);
while ($datos = mysql_fetch_array($resp)) {
if ($mostrar > 0) {
$fecha = date("d/m/Y",$datos[fecha]);
echo "
<table width=23% height=88 border=0 align=left>
<tr>
<td valign=top bgcolor=#000099><div align=center>
<p><font color=#FFFF00><strong>$datos[titulo]</strong></font></p>
<p><font color=#FF0000><strong>$datos[autor] <font color=#FFFFFF>$fecha</font></strong></font></p>
</div></td>
</tr>
</table>
<p> </p>
<p> </p>
<table width=80% border=0>
<tr>
<td bgcolor=#000099><font color=#FFFFFF>$datos[noticia]</font></td>
</tr>
</table>
\n";
$mostrar--;
}
}
mysql_query($query); //insertamos el dato
mysql_close($conecta); //cierra la conexion
?>
me sale error dice asi:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in c:\appserv\www\appserv\cdr\noticias.php on line 16