Vaske
-
Posts
11 -
Joined
-
Last visited
Posts posted by Vaske
-
-
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>
-
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
-
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!
-
10 minutes ago, Barand said:
[correction to question]
Honestly I have no idea, it just doesn't work when I change it to GET , but it doesnt matter to me much it works fine when I have 2 search pages so I'm fine with that. If it works I don't mind
-
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>
-
28 minutes ago, Barand said:
Why, what have you changed there?
Only changed the $_POST into $_GET but its fine I made a second search page and put $_POST in it to make the search bar work. Thanks again for all the help!
-
16 minutes ago, Barand said:
Have you got
if(isset($_POST['submit'])){
or
if(isset($_GET['search'])){
ok so I did this and it works thank you! But now the search bar doesnt work at all. Any way to make both of them work together? Maybe I should make 2 search.php files one for each instance?
-
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
-
32 minutes ago, ginerjm said:
$_GET['search']
Sorry to bother you, but I'm completely new to this and have been following a tutorial so far and I think I learned quite a bit, but some things I still need help with. Where do I put the $_GET['search'] and how do I use it?
-
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>
Carousel with database
in PHP Coding Help
Posted
No error report, just the image doesn't show up.