Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Primeiramente gostaria de pedir desculpas se minha pergunta não estiver adequadamente formatada com as regras do fórum. Mas estou com tempo curto e prometo que no futuro irei melhorar isso. Tentarei ser o mais detalhista e claro possível com a minha pergunta.
Sou iniciante em PHP/HTML e estou precisando de ajuda para organizar as informações dentro de um quadro. Para ficar mais fácil de explicar, estarei postando prints.
Esse é o formato desejado (nesse print está apenas o HTML, sem PHP):
**Esse é o formato atual (resultado após inserir o "select * from" do PHP):**
Eu quero que todas as informações sejam exibidas automaticamente, à medida que elas são adicionadas ao banco de dados. Mas até o momento eu só consegui fazer com que as informações sejam passadas no primeiro quadro (Project First, como na primeira imagem).
**Eis aqui o código sem php: **
<div id="fh5co-portfolio">
<div class="fh5co-portfolio-item ">
<div class="fh5co-portfolio-figure animate-box" style="background-image: url(images/work_1.jpg);"></div>
<div class="fh5co-portfolio-description">
<h2>Project First</h2>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.</p>
<p><a href="#" class="btn btn-primary">Read the casetudy</a></p>
</div>
</div>
<div class="fh5co-portfolio-item fh5co-img-right">
<div class="fh5co-portfolio-figure animate-box" style="background-image: url(images/work_2.jpg);"></div>
<div class="fh5co-portfolio-description">
<h2>Project Second</h2>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.</p>
<p><a href="#" class="btn btn-primary">Read the casetudy</a></p>
</div>
</div>
<div class="fh5co-portfolio-item ">
<div class="fh5co-portfolio-figure animate-box" style="background-image: url(images/work_3.jpg);"></div>
<div class="fh5co-portfolio-description">
<h2>Project Third</h2>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.</p>
<p><a href="#" class="btn btn-primary">Read the casetudy</a></p>
</div>
</div>
<div class="fh5co-portfolio-item fh5co-img-right">
<div class="fh5co-portfolio-figure animate-box" style="background-image: url(images/work_4.jpg);"></div>
<div class="fh5co-portfolio-description">
<h2>Project Fourth</h2>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.</p>
<p><a href="#" class="btn btn-primary">Read the casetudy</a></p>
</div>
</div>
</div>
**E aqui o código com PHP:**
<div id="fh5co-portfolio">
<?php
$stmt = $DB_con->prepare('SELECT * FROM blog ORDER BY blogID ASC');
$stmt->execute();
if($stmt->rowCount() > 0)
{
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
extract($row);
?>
<div class="fh5co-portfolio-item ">
<div class="fh5co-portfolio-figure animate-box" style="background-image: url(images/work_1.jpg);"><img class="blog" src="<?php echo PATH.'assets/images/blog/';?><?php echo $imgresumo;?>" ></div>
<div class="fh5co-portfolio-description">
<h2><?php echo $titulo;?></h2>
<p><?php echo $resumo;?></p>
<p><a href="<?php echo PATH.'';?>blogp/blog-single.php?view_id=<?php echo $row['blogID']; ?>" class="btn btn-primary">Continuar lendo...</a></p>
</div>
</div>
<?php
}
}
else
{
?>
<div class="col-xs-12">
<div class="alert alert-warning">
<span class="glyphicon glyphicon-info-sign"></span> Nenhuma postagem encontradada
</div>
</div>
<?php } ?>
<div class="fh5co-portfolio-item fh5co-img-right">
<div class="fh5co-portfolio-figure animate-box" style="background-image: url(images/work_2.jpg);"></div>
<div class="fh5co-portfolio-description">
<h2>Project Second</h2>
<p>Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia.</p>
<p><a href="#" class="btn btn-primary">Read the casetudy</a></p>
</div>
</div>
</div>Carregando comentários...