php loop breaking down my css look

673

I am using an while loop and i want to generate the output in a well formatted look like a portfolio my code is here i just dont know what is breaking it down

<div >

  <div >
  <?php 
  while($fetch=mysqli_fetch_assoc($run)){
  ?>
  <div >
        <a href="#">
          <img src="~admin/uploadsthumbs/<?php echo $fetch['daily_img'];?>" alt="">
        </a>
  </div>
  <?php
  }
  ?>               
  </div>

</div>

However the desired output which i want to have is like in the link below in the Related Project sections. https://blackrockdigital.github.io/startbootstrap-portfolio-item/

939

Answer

Solution:

use this code:

<div >

<div >
<?php 
while($fetch=mysqli_fetch_assoc($run)){
echo '
<div >
      <a href="#">
        <img src="~admin/uploadsthumbs/'.$fetch['daily_img'].'" alt="">
      </a>
</div>';
}   ?>           
</div>

406

Answer

Solution:

It might be your query result ($run) or class in the img tag.

If it is displaying the image, it is not the $run but the class in the img tag or bootstrap is not present in your script else it is the $run.

Enjoy coding for this is the fun of it.

People are also looking for solutions to the problem: php - Print json to string

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.