1
I have the following script that returns me the status and the amount of posts you have in this state, now I would like to display these posts, someone knows some solution?
<?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
}
?>
My problem is that the data are separate tables and I need to unite all in a single selection.
– Henrique S. Santos
@Henriques.Santos, right now, the problem is that your question does not have enough details... Which tables
treasuremap
are those? How are they created? What does that have to do with your site? Has an "edit" link just below the question, can modify the will (as long as it does not change the original meaning of the question).– brasofilo