How to create dynamic, responsive image slider with PHP, mysqli, bootstrap and jQuery ?

Description :- In this lesson I’m gonna provide the code from which you guys can easily make fully Dynamic Carousel  Silder from which you’ll fetch image name from database and images from your img folder.

Establishing Database:-
Now, I know that you all guys know how to create new database and name it slider after this create new table and name it images and make 2 rows
(i) id
(ii) img 
And then insert your image name with extension into the img row .

Now follow some simple steps for setting up everything which we need for this lesson:-
1. Download the bootstrap
2. Download jquery file from jquery.com
2. Create a new folder and rename it as img and put some images in it.
3. Create a new folder and rename it as css and make app.css in the css folder
4. Create an index.php file
5. Create config.php file (the connection file to our database)

1. config.php   (the connection file)

<?php
$con = mysqli_connect("localhost","root","","slider");
if(mysqli_errno($con))
{
 echo mysqli_error(); 
}
?>

2. index.php  (the file where your silder code lives with some jquery lines)

There are some problems with wordpress text editor so I’m providing pdf of index.php copy from pdf and make index.php
Copy code from this link

3. app.css   (lives in css folder)

.

a.carousel-control {
 opacity: 1;
 height: inherit;
 width: inherit;
 background: none;
 text-shadow: none;

}
.prevSlide
{
 color: #f5f5f5;
 font-size: 2em;
 position: absolute;
 top: 50%;
 left: 0;
 background-color:rgba(0,0,0,0.5);
 transform: translate(0,-50%);
 padding: 0 10px;
}
.prevSlide:hover
{
 color:rgba(247,148,30,1);
 background-color:rgba(0,0,0,0.8);
}
.nextSlide
{
 color: #f5f5f5;
 font-size: 2em;
 position: absolute;
 top: 50%;
 right: 0;
 background-color:rgba(0,0,0,0.5);
 transform: translate(0,-50%);
 padding: 0 10px;
}
.nextSlide:hover
{
 color:rgba(247,148,30,1);
 background-color:rgba(0,0,0,0.8);
}

*Note:- My final product screenshot is this except the images in the slider you will get the same result.

Thanks 🙂

slider

index

25 thoughts on “How to create dynamic, responsive image slider with PHP, mysqli, bootstrap and jQuery ?

  1. hello i don’t understand what you mean by insert your image name with image extension into the image row and besides it it column or row

    Like

    • Image name and image extension like one.jpg and I was talking about the img row of you database. So you have to insert the image name with the extension into the the img row of your database.

      Like

      • kindly explain this your first statement clearly…. how i did add the image to my database. thanks

        “Establishing Database:-
        Now, I know that you all guys know how to create new database and name it slider after this create new table and name it images and make 2 rows
        (i) id
        (ii) img
        And then insert your image name with extension into the img row .

        Like

  2. Thanks i have found solution in your code you need to remove the img/ from this line of index code <img src=" img/” class=”imgresponsive”
    alt=””/>

    I hope it will solve other users challenges thanks i really appreciate your effort

    Like

  3. thanx a lot. ur code works just like rockzzzzzzzzzzzzzzz……………………………

    thanx friend..

    Like

  4. hello sir, where can i download the bootstrap/js/jquery.js? i can’t seem to find it 😦 and my slider is not working. thank you!

    Like

Leave a comment