I have the following script that returns me the status and the amount of posts it has in this state, now I would like to view these posts, does anyone know of any solutions?
<?php
$query="
SELECT
e.id ID,e.uf UF, e.nome Estado, COUNT( 1 ) Quantidade
FROM
wp_treasuremap_posts p, wp_treasuremap_postmeta m, wp_treasuremap_localizacao_cidade c, wp_treasuremap_localizacao_estado e
WHERE
p.id = m.post_id
AND post_type = 'denuncia'
AND meta_key = 'estado_e_cidade'
AND post_status != 'trash'
AND meta_value = c.id
AND c.estado = e.id
GROUP BY
e.uf, e.nome
ORDER BY
3 DESC ";
$result=mysql_query($query);
$tot=mysql_num_rows($result);
$c=0;
while($row=mysql_fetch_object($result)){
$ID=$row->ID;
$Estado=$row->Estado;
$Quantidade=$row->Quantidade;
?>
<li>
<a href="http://site.com.br/?page_id=22277&estado=<?=$ID;?>"><?=$Estado;?> <?=$Quantidade;?></a>
</li>
<?php
}
?>