Jump to content

Vaske

Members
  • Posts

    11
  • Joined

  • Last visited

Posts posted by Vaske

  1. 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>

     

  2. 3 minutes ago, maxxd said:

    You can't make it work without altering the code you already have. Your code doesn't take pagination into account, so in order to use pagination you must alter your code.

    You'll need to add a LIMIT clause to your query, then add links that target the same page with an updated starting record ID. When your page is loaded, check to see if that start number is set - if it is, it becomes the new starting offset in your SQL limit clause. If it doesn't exist, the starting offset is 0.

    That should be enough to put you on the right path - give it a shot and if it doesn't work post your code here with your questions.

    What I meant to say was I just want to keep the card and have pagination with the cards instead of having a pagination with lists. But every tutorial or guide I find makes php and mysql paginations only with lists

  3. So I'm making a project and want to have a pagination of cards using PHP and MySQL, but every tutorial I find shows only pagination of lists and I cant seem to figure out how to make pagination for cards work. Any help would be appreciated!

  4. Hi I'm fairly new to this and want to make a pagination for my project, the problem is no matter how many times I try I cant seem to make it work without altering the code I already have. I would appreciate if someone could help me figure out How to make a pagination without altering the already existing code I have.

     

    Here is the page I want pagination on:

     

    <div class="content">
        <div class="row">
            
        
        <?php 
    
        $query = "SELECT * FROM movie";
        $run = mysqli_query($con,$query);
        if ($run) {
    
            while($row = mysqli_fetch_assoc($run)){
                ?>
    
    <div class="col">
        <div class="card border border-success" style="width: 18rem;text-align: center; background-color:#343a40;">
      <img class="card-img-top" height="300px" width="100px" src="admin12312/thumb/<?php echo$row['imgpath']; ?>" alt="Card image cap">
      <div class="card-body">
        <h5 class="card-title" style="color: green;"><?php echo$row['name']; ?></h5>
    <br>
        
        <a href="viewmovie.php?id=<?php echo $row['id']; ?>" class="btn btn-outline-success my-2 my-sm-0">Watch</a>
      </div>
    </div>
    </div>
    
                <?php
    
            }
    
        }
    
         ?>
    </div>
    </div>

     

  5. 20 minutes ago, Barand said:

    Use instead of $_POST['search'].

    If the search=??? is in the url query string, the key/value pair will be put into the GET array.

    For those times when you are just getting data (as in a search) use GET. If updating something, use POST

    I tried replacing the $_POST['search'] with $_GET['search'] but I end up getting undefined index: search

  6. I wasn't to make a link go to a specific search but I cant seem to make it work, I would appreciate any help here!

     

    Here is a part of the main page:

    Categories
            </a>
            <div class="dropdown-menu" style="background-color: black;" aria-labelledby="navbarDropdown">
              <a style="color: green;" class="dropdown-item" href="search.php?search=action">Action</a>
              <a style="color: green;" class="dropdown-item" href="search.php?search=comedy">Comedy</a>
              <a style="color: green;" class="dropdown-item" href="search.php?search=drama">Drama</a>
              <a style="color: green;" class="dropdown-item" href="search.php?search=fantasy">Fantasy</a>
              <a style="color: green;" class="dropdown-item" href="search.php?search=horror">Horror</a>
              <a style="color: green;" class="dropdown-item" href="search.php?search=mistery">Mistery</a>
              <a style="color: green;" class="dropdown-item" href="search.php?search=romance">Romance</a>
              <a style="color: green;" class="dropdown-item" href="search.php?search=thriller">Thriller</a>
              <a style="color: green;" class="dropdown-item" href="search.php?search=western">Western</a>
              <a style="color: green;" class="dropdown-item" href="search.php?search=scifi">SciFi</a>
            </div>
          </li>

    And here is the search.php:

     

    <?php
    include("db.php");
    include("header.php");
    include("footer.php");
    ?>
    
    <div class="row">
    <?php
    
    if(isset($_POST['submit'])){
    	$search = $_POST['search'];
    	$searchpreg = preg_replace("#[^0-9a-z]#i", "", $search);
    	
    	$query = "SELECT * FROM movie WHERE name LIKE '%$search%' or genre LIKE '%$search%'";
    	$run = mysqli_query($con,$query);
    	$count = mysqli_num_rows($run);
    	if($count == 0){
    		echo "<div style='text-align:center;'><h1>No Movie Found</h1>".$search."</div>";
    	}
    	else{
    		while($row = mysqli_fetch_assoc($run)){
    			?>
    			<div class="col">
    				<div class="card border border-success background-color:" style="width:200px; text-align:center; background-color:#343a40;">
    			<a href="viewmovie.php?id=<?php echo $row['id']; ?>"><?php echo "<img height='180px' width='180' src='admin12312/thumb/".$row['imgpath']."'>"; ?></a>
    			<p style="color: green;"><?php echo $row['name']; ?></p>
    			</div>
    			</div>
    			<?php
    			
    			
    		}
    	}
    }
    
    ?>
    
    </div>

     

×
×
  • 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.