Jump to content

Recommended Posts

So I'm working on a project and want my carousel to present most recently added 3 images and each of those images needs to lead to its own page how would I possibly achieve this, I tried multiple times but I keep running into problems some of them I manage to figure out but at the end its always the same result of not working. Any help is much appreciated!

Here is the carousel:

<div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
  <ol class="carousel-indicators">
    <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
    <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
  </ol>
  <div class="carousel-inner">
    <div class="carousel-item active">
      <img class="d-block w-100" src="amin/thumb/<?php $row['imgpath']; ?>" alt="First slide">
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="..." alt="Second slide">
    </div>
    <div class="carousel-item">
      <img class="d-block w-100" src="..." alt="Third slide">
    </div>
  </div>
  <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>

 

Link to comment
https://forums.phpfreaks.com/topic/314239-carousel-with-database/
Share on other sites

16 hours ago, Vaske said:
<img class="d-block w-100" src="amin/thumb/<?php $row['imgpath']; ?>" alt="First slide">

That line is wrong. It should be either
 

<img class="d-block w-100" src="amin/thumb/<?php echo $row['imgpath']; ?>" alt="First slide">

  // or

<img class="d-block w-100" src="amin/thumb/<?= $row['imgpath']; ?>" alt="First slide">

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.