Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/06/2008, 17:40
vmac179
 
Fecha de Ingreso: julio-2007
Ubicación: /home/victor
Mensajes: 114
Antigüedad: 16 años, 9 meses
Puntos: 0
Respuesta: mostrar lista de categorias y contar sus entradas

Disculpen la consulta la hice de esta manera

Código PHP:
select A.nombre_catcount(B.categoriafrom noticias_cat Anoticias B where B.categoria=A.id group by A.nombre_cat 
cuenta las noticias que existen en cada categoría y solo la muestra si tiene mas de una el problema que tengo ahora es que no me esta mostrando la ID de la categoría para generar el link.
Código PHP:
$query_cat "select A.nombre_cat, count(B.categoria) from noticias_cat A, noticias B where B.categoria=A.id group by A.nombre_cat";

$resp_cat pg_query($query_cat);

echo 
"<ul>";

while (
$cat pg_fetch_array($resp_cat)) {

echo 
"\n<li><a href=\"$PHP_SELF?action=categoria&id=$cat[0]\" title=\"$cat[descripcion]\">$cat[0] ($cat[1])</a></li>";

}

echo 
"\n</ul>"
si me pueden ayudar se los agradecería