So I have this kind of project to have post divided into several provinces. I can show the post but only 1 if there is 2 posts or more it will only show me 1 post. This is my code with PHP
<?php $p3=1;$posts=mysql_query("select * from provinces INNER JOIN posts ON posts.id_province=provinces.id_province");
while($ps3=mysql_fetch_array($posisititik3)){
$jdlpost=$ps3[nm_news];
$despost=$ps3[desc];
$jdlprovince=$ps3[nm_province];
$link3=$_COOKIE[linkmenu].$ps3['id_news']."/"."news/".linktitle($ps3['nm_news']);
if($p3===1){
echo "<div class=modal fade in' id='tc$ps3[id_news]> <div class=modal-dialog modal-lg> <div class='modal-content' style= 'margin-top: 100px;'>"
."<div class='modal-header'>"
."<h5 class='modal-title' id='exampleModalLabel'>$jdlprovince</h5>
<button type='button' class='close' data-dismiss='modal' aria-label='Close'>
<span aria-hidden='true'>×</span>
</button>"
."</div>"
."<div class='modal-body'>"
."<div class='row'>"
."<div class='col-md-12'>"
."<div class='box-list'>"
."<div class='detailgeo dg3 tampil$ps3[id_news] active view view-tenth'>"
."<div class='coverhover'><div class='imgs' style='background-image:url(".$_COOKIE[config]."dynamic/200/imgnews/".$ps3[pict].")'> </div>
<div class='mask'>
<a href='$link3' class='info' title='$jdlpost'><i class='fa fa-search'></i></a>
</div>
</div>"
."<div class='ise'><b><a href='$link3'>$jdlpost</a></b><i>".ucfirst(textlimit(rmSpecialChars(cleanHTML($despost)),180))."</i><div class='clear'></div><a href='$link3'class='remor' class='remor'>READ MORE <i class='fa fa-chevron-right'></i></a></div>"
."</div>"
."</div>"
."</div>"
."</div>"
."</div>"
."</div>"
."</div>"
."</div>";
So I want the output look like this 
But my code only retrieve 1 post like this
I don't have any idea how to retrieve more than 1 post in my code with same id_province. So I repeat again if there is 2 post with same id_province so it will retrieve like my 1st picture. Thanks
Thanks For helping guys.
Aucun commentaire:
Enregistrer un commentaire