la estructura de la db son estas:
Código PHP:
#
# --------------------------------------------------------
#
# Estructura de tabla para la tabla `noticias`
#
create table noticias (
id_noticia int(4) auto_increment not null,
autor varchar(255),
titulo varchar(255),
categoria varchar(255),
fecha datetime not null,
noticia blob, key(id_noticia)
) TYPE=MyISAM;
# ---------------------------------
#
# Estructura de tabla para la tabla `Comentarios`
#
create table comentarios(
id int(4) not null,
nick varchar(40) NOT FULL,
email varchar(50),
comentario blob, key(id)
) TYPE=MyISAM;
# --
index.php
Código PHP:
if(isset($_GET['cat']))
{
$result=mysql_query("select '" . $cat . "' from noticias order by fecha Desc", $connect);
$totalregistros=mysql_num_rows($result);
$result2=mysql_query("select * from comentarios where id",$connect);
$totalcomentarios=mysql_num_rows($result2);
}
else
{
$result=mysql_query("select * from noticias order by fecha Desc", $connect);
$totalregistros=mysql_num_rows($result);
$result2=mysql_query("select * from comentarios where id",$connect);
$totalcomentarios=mysql_num_rows($result2);
}