Create Dynamic Image Slider using PHP with jQuery

Create Dynamic Image Slider using PHP with jQuery

Today, We want to share with you Create Dynamic Image Slider using PHP with jQuery.
In this post we will show you Create Dynamic Image Slider using PHP with jQuery, hear for Create Dynamic Image Slider using PHP with jQuery we will give you demo and example for implement.
In this post, we will learn about Create Dynamic Image Slider using PHP with jQuery with an example.

LightSlider is The Best Responsive jQuery Image Slider Plugins here in This Post,we can used to Create Dynamic Image Slider using PHP,jQuery – Responsive Image slider.

Table structure for table Name : `subprojectimg`

First of simple Create a table Like Table Name `subprojectimg` and Follwing the Execute This Follwing Script run in SQL phpmyadmin and create table

Also Read :  Create Dynamic Image Fancybox Gallery with jQuery, PHP & MySQL

CREATE TABLE IF NOT EXISTS `subprojectimg` (
  `spmid` int(11) NOT NULL AUTO_INCREMENT,
  `pmid` int(11) NOT NULL,
  `spmtitle` varchar(255) NOT NULL,
  `spmimg` varchar(255) NOT NULL,
  `status` int(11) NOT NULL DEFAULT '1',
  PRIMARY KEY (`spmid`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=35 ;

Dumping data for table Name : `subprojectimg`

Simple Copy This Script and execute in mysql snipset phpmyadmin and insert all rows added.

INSERT INTO `subprojectimg` (`spmid`, `pmid`, `spmtitle`, `spmimg`, `status`) VALUES
(1, 4, 'Pakainfo.com at mr. ch d', '1.jpg', 1),
(2, 4, 'Pakainfo.com at mr. chd', '2.jpg', 1),
(3, 4, 'Pakainfo.com at mr. chd', '3.jpg', 1),
(4, 4, 'Pakainfo.com at mr. chd', 'nature-d.jpg', 1),
(5, 4, 'Pakainfo.com at mr. chd', 'nature-c.jpg', 1),
(6, 4, 'Pakainfo.com at mr. chd', 'nature-b.jpg', 1),
(7, 4, 'Pakainfo.com at mr. chd', 'nature-a.jpg', 1),
(8, 4, 'Pakainfo.com at mr. chd', 'graffiti-b.jpg', 1);

config.php

<?php
   $dbhost = 'localhost';
   $dbuser = 'root';
   $dbpass = 'pass***@#$%^&[email protected]@#$';
   $dbname = 'YourDataBaseName';
   //create a simple mysql config
   $conn = mysql_connect($dbhost, $dbuser, $dbpass);
   if(! $conn )
   {
	//Error log generated
     die('Could not connect: ' . mysql_error());
   }
   //select your DataBase
	mysql_select_db($dbname) or die(mysql_error());

?>

index.php

<?php
<?php include("config.php"); ?>
?>
<div class="row">
	<div class="col-md-12">
		<div class="main-slider">
			<ul id="lightSlider">
			<?php
		
		$sevlist=mysql_query("select * from subprojectimg where status=1 and pmid=$pid");
		while($projectlist=mysql_fetch_array($sevlist))
		{
			
			?>
			<li data-thumb="images/thumbs/<?php echo $projectlist['spmimg'];?>">
					<img src="images/<?php echo $projectlist['spmimg'];?>" alt=""/>
					<h4><?php echo $projectlist['spmtitle'];?></h4>
			</li>
		<?php
		}
		?>
			</ul>
		</div>
	</div>
</div>

LightSlider For jquery Script

<script type="text/javascript">
		$(document).ready(function() {
			$('#lightSlider').lightSlider({
			gallery: true,
			item: 1, //per use images no
			loop: true, //using loop
			slideMargin: 0,
			thumbItem: 6, //per slot show images in slider	
			});			
		});
	</script>

View Demo

Also Read :  Bootstrap Toggle switch with ajax update to mysql in Laravel

We hope you get an idea about Create Dynamic Image Slider using PHP with jQuery
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

We hope This Post can help you…….Good Luck!.

Recommended For You.

Laravel Send Email Attachment Tutorial With Example
Today, We want to share with you Laravel Send Email Attachment Tutorial With Example.In this post we will show you

Add a Comment

Your email address will not be published. Required fields are marked *