I am trying to make a carousel that uses Twitter Bootstrap default JavaScript and CSS but the images should be fetched from the MySQL database.
The HTML for the carousel that i am trying to make dynamic with php is like this:
<div class="carousel-inner">
<div class="active item">
<img src="images/sampleAd.jpg" class="pull-left marginTop">
<img src="images/sampleAd.jpg" class="pull-left marginTop">
<img src="images/sampleAd.jpg" class="pull-left marginTop">
<img src="images/sampleAd.jpg" class="pull-left marginLast">
</div>
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
The end result for PHP file that i'm expecting is like this
<div class="carousel-inner">
<?php renderAds(); ?>
</div>
The PHP function that i wrote is like this :
function renderAds(){
$query = queryAds();
$query_exe = mysql_query($query);
if(mysql_num_rows($query_exe) == 0){
echo '<img src="images/sampleAd.jpg" >';
}else{
$numb =1;
$flag =1;
while($fetched_data = mysql_fetch_array($query_exe)){
if($numb == 1){
if($flag == 1){
echo '<div class="active item">';
}else{
echo '<div class="item">';
}
}elseif($numb == 4){
echo '';
echo '</div>';
$numb =0;
}else{
echo '';
}
$numb++;
$flag++;
}
echo '<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>';
echo '<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>';
}
}
Here, by differing from default carousel of twitter bootstrap, i made each slide with 4 images, i expect that each slide transition contains 4 images instead of as by default the single image for one slide. In HTML it works but when I replace it with my PHP function first slide works but if i press next arrow in carousel whole div collapses.
How can I make it work ?
Note : Here Last image must contain the class marginLast, and the
other should have marginTop and pull-left classes.
What I expect to be rendered in html is like this:
<div class="carousel-inner">
<div class="active item">
<img src="images/sampleAd.jpg" class="pull-left marginTop">
<img src="images/sampleAd.jpg" class="pull-left marginTop">
<img src="images/sampleAd.jpg" class="pull-left marginTop">
<img src="images/sampleAd.jpg" class="pull-left marginLast">
</div>
<div class="item">
<img src="images/sampleAd.jpg" class="pull-left marginTop">
<img src="images/sampleAd.jpg" class="pull-left marginTop">
<img src="images/sampleAd.jpg" class="pull-left marginTop">
<img src="images/sampleAd.jpg" class="pull-left marginLast">
</div>
<div class="item">
<img src="images/sampleAd.jpg" class="pull-left marginTop">
<img src="images/sampleAd.jpg" class="pull-left marginTop">
<img src="images/sampleAd.jpg" class="pull-left marginTop">
<img src="images/sampleAd.jpg" class="pull-left marginLast">
</div>
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
How can i make my PHP function to display result markup like above?
Edit : The Output i get is like this:
<div id="myCarousel" class="carousel slide">
<!-- Carousel items -->
<div class="carousel-inner">
<div class="active item">
</div>
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div><!-- end carousel-inner -->
</div><!-- myCarousel -->
According to markup this should work but it doesn't, the arrow by default if there is no more slide than one should be disabled but it is clickable.
Have you MySQL query return just an array. That way, your query's reusable (could be then made into a function) and you can render the data however you see fit.
<?php
$mysqli = new mysqli('localhost', 'username', 'password', 'database');
$sql = "SELECT * FROM table";
$res = $mysqli->query($sql);
$rows = array();
while ($row = $res->fetch_assoc()) {
$rows[] = $row;
}
?>
<div class="carousel">
<div class="carousel-inner">
<?php $i = 1; ?>
<?php foreach ($rows as $row): ?>
<?php $item_class = ($i == 1) ? 'item active' : 'item'; ?>
<div class="<?php echo $item_class; ?>">
<a href="<?php echo $row['url']; ?>">
<img src="<?php echo $row['image']; ?>" alt="<?php echo $row['title']; ?>" />
</a>
</div>
<?php $i++; ?>
<?php endforeach; ?>
</div>
</div>
You'll obviously need to change the database query, as well as the values then used in the foreach loop. I've also used the mysqli functions, as the mysql functions are now deprecated in favour of MySQLi (MySQL improved).
I think i came out with answer for my own question, even though all the above answers gave me many ideas. Thank you all
function renderAds(){
$query = queryAds();
$query_exe = mysql_query($query);
if(mysql_num_rows($query_exe) == 0){
echo '<img src="images/sampleAd.jpg" >';
}else{
$numb =1;
$flag =1;
echo '<div class="carousel-inner">';
while($fetched_data = mysql_fetch_array($query_exe)){
if($numb == 1){
if($flag == 1){
echo '<div class="active item">';
}else{
echo '<div class="item">';
}
echo '<a target="_blank" href="http://'.$fetched_data['url'].'" class="pull-left marginTop" ><img src="'.$fetched_data['image_url'].'"></a>';
}elseif($numb == 4){
echo '<a target="_blank" href="http://'.$fetched_data['url'].'" class="pull-left marginLast" ><img src="'.$fetched_data['image_url'].'"></a>';
$numb = 0;
echo '</div>';
}else{
echo '<a target="_blank" href="http://'.$fetched_data['url'].'" class="pull-left marginTop" ><img src="'.$fetched_data['image_url'].'"></a>';
}
$numb++;
$flag++;
}
if($numb > 1 && $numb < 4 ){
echo '</div>';
echo '</div>';
}elseif($numb == 1){
echo '</div>';
}elseif($numb == 4){
echo '</div>';
echo '</div>';
}
echo '<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>';
echo '<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>';
}
}
<div class="carousel-inner">
<?php
// Twitter Bootstrap Carousel.
$caseStudies = get_posts(array(
'numberposts' => 12,
'post_type' => 'case-study',
'meta_key' => 'show_case_study_home',
'meta_value' => 'yes',
'post_status' => 'publish',
));
$open = 0;
$close = 1;
$active = 0;
$didClose = false;
foreach($caseStudies as $caseStudy){
$image = get_field('image_home', $caseStudy->ID);
$header = get_field('header_home', $caseStudy->ID);
$intro = get_field('intro_home', $caseStudy->ID);
$activeCss = "";
if(($open)%4 == 0) {
if ($active == 0) $activeCss = " active";
echo '<div class="item'. $activeCss .'"><ul class="thumbnails">';
}
?>
<li class="span3">
<div class="case-study">
<img src="<?php echo $image['url']; ?>" alt="">
Read More
<h4><?php echo $header; ?></h4>
<p><?php echo $intro; ?></p>
</div>
</li>
<?
if(($close)%4 == 0) {
echo "<ul></div>";
$didClose = true; // Maybe the carousel has less than 4 items ...
}
$open++;
$close++;
$active++;
}
if($didClose == false) echo "</div></div>"; // If has less than 4 items in the carousel close the tags.
?>
</div><!--/.caroussel-inner -->
I solved it as :
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<?php $slider = $guest->getAllData("slider"); ?>
<?php foreach( $slider as $slide) : ?>
<li data-target="#myCarousel" data-slide-to="<?=$slide['id']; ?>" class=""></li>
<?php endforeach; ?>
</ol>
<div class="carousel-inner">
<?php foreach($slider as $slide) : ?>
<div class="item ">
<img src="images/slider/<?=$slide['img']; ?>" alt="Los Angeles">
</div>
<?php endforeach; ?>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>
and add JS code:
$('.carousel-indicators>li:first-child').addClass('active');
$('.carousel-inner>div:first-child').addClass('active');
Related
Hello i am trying to display 3 post item of bootstrap carousel in Microweber. I am trying my luck here as not much info can be found in microweber as i am stuck for a few days. Here is my code.
<?php if (!empty($data)): ?>
<script>mw.require("<?php print $config['url_to_module']; ?>css/style.css", true); </script>
<?php $rand = 'item_carousel_'.$params['id']; $id = 'carousel_'.$params['id']; ?>
<div id="<?php print $id; ?>" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<?php $count = -1; foreach($data as $item): ?>
<?php $count++; ?>
<div class="carousel-item <?php if($count == 0){ print 'active ';} ?>">
<div class="col-12 col-md-4">
<div class="card mb-2">
<?php if($item['tn_image']): ?>
<?php endif; ?>
<div class="card-body">
<h4 class="text-center card-title"><?php print $item['title'] ?></h4>
<p class="card-text"><?php print $item['description']; ?></p>
</div>
</div>
</div>
</div>
<?php endforeach ; ?>
</div>
<!--Controls-->
<a class="carousel-control-prev " href="#<?php print $id; ?>" role="button" data-slide="prev">
<span class="fas fa-chevron-circle-left fa-2x" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#<?php print $id; ?>" role="button" data-slide="next">
<span class="fas fa-chevron-circle-right fa-2x" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
<!--/.Controls-->
</div>
<?php else : ?>
<?php endif; ?>
Currently it is display like this
But i want it to display 3 image in a row and using the control to rotate the next 3 post item.
1 - which template you are using?
2 - you can use slidesToShow: 3 in slick slider init
For example:
$('.multiple-items').slick({
infinite: true,
slidesToShow: 3,
slidesToScroll: 3
});
I have Carousel with 4 images like given in the following image.
My Effort is given in following.
<div id="thumbCarousel" class="carousel slide">
<div class="carousel-inner">
<?php $i=0; foreach($this->partner_images as $sr){?>
<?php if($i==0){ ?><div class="item active"><?php } ?>
<?php if($i ==4){ ?><div class="item"><?php }?>
<div class="col-xs-3">
<a href="<?php echo $sr['url']; ?>">
<img src="<?php echo BASE_URL?>/partner-images/<?php echo $sr['name']?>" />
</a>
</div>
<?php if($i==3 or $i==7){ ?></div><?php }?>
<?php $i++; } ?>
</div>
<a class="thumbleft" href="#thumbCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="thumbright" href="#thumbCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span> </a>
</div>
</div>
Problem:
The problem is that it is working fine for 4 images and for 8 images, so when there are 4 or more picture are not showing properly. I want to do it automatically either images are even or odd.
Question:
My question is how i can show 4 or more images like shown in the images automatically ?
I try this and it is working fine.
<div id="thumbCarousel" class="carousel slide">
<div class="carousel-inner">
<?php $i=0; foreach($this->partner_images as $sr){?>
<?php if($i==0){ ?><div class="item active"><?php } ?>
<?php if($i % 2 == 0){ ?><div class="item"><?php }?>
<div class="col-xs-3">
<a href="<?php echo $sr['url']; ?>">
<img src="<?php echo BASE_URL?>/partner-images/<?php echo $sr['name']?>" />
</a>
</div>
<?php if($i % 4 != 0){ ?></div><?php }?>
<?php $i++; } ?>
</div>
<a class="thumbleft" href="#thumbCarousel" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="thumbright" href="#thumbCarousel" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span> </a>
</div>
</div>
I am working on a PHP based website which is using Twitter Bootstrap 2. I am pulling the users from MySQL database and trying to display them in multiple frames/items of carousel on a screen rather than a single item using while loop.
This is what my carousel looks like at present, as you will notice user 5 is not supposed to appear the way it is right now and is only supposed to appear when i click on arrow on right side of the carousel.
This is what my php code looks like
<div class="carousel slide" id="myCarousel">
<h4 class="carousel-title">Text title</h4>
<div class="carousel-inner">
<?php
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
?>
<div class="item active">
<div class="span3 mef-3">
<div class="about portrait">
<div class="tooltip-demo">
<a href="#" rel="tooltip" data-placement="top" data-toggle="tooltip"
data-title="">
<img class="img-circle" width="180" height="200" data-src="holder.js/360x270"
alt="270x280"
style="" src="assets/img/adviser.png"></a>
</div>
<div class="caption">
<h3 class="name" style="text-align: center"><?php echo $row['fname']." ".$row['lname'] ?></h3>
<p style="text-align: center">
Specialities</p>
</div>
<div class="mefradio">
<input type="radio" name="adviser" id="adviser" value='<?php echo $row['user_id']."|".$row['fname']." ".$row['lname'] ?>'><br>
</div>
</div>
</div>
</div>
<?php
}
?>
</div>
<a data-slide="prev" href="#textCarousel" class="left carousel-control">‹</a>
<a data-slide="next" href="#textCarousel" class="right carousel-control">›</a>
</div>
I will really appreciate any guidance on how to get it to work
UPDATE
This is the updated code that is working, thanks to #I can Has Kittenz
<div class="carousel slide" id="myCarousel">
<h4 class="carousel-title">Text title</h4>
<div class="carousel-inner">
<?php
$i = 1;
$next_item = true;
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
if ($i == 1) {
echo '<div class="item active">';
} elseif ($next_item == true) {
echo '<div class="item">';
}
?>
<div class="span3 mef-3">
<div class="about portrait">
<div class="tooltip-demo">
<a href="#" rel="tooltip" data-placement="top" data-toggle="tooltip"
data-title="">
<img class="img-circle" width="180" height="200" data-src="holder.js/360x270"
alt="270x280"
style="" src="assets/img/adviser.png"></a>
</div>
<div class="caption">
<h3 class="name"
style="text-align: center"><?php echo $row['fname'] . " " . $row['lname'] ?></h3>
<p style="text-align: center">
Specialities</p>
</div>
<div class="mefradio">
<input type="radio" name="adviser" id="adviser"
value='<?php echo $row['user_id'] . "|" . $row['fname'] . " " . $row['lname'] ?>'><br>
</div>
</div>
</div>
<?php
$next_item = false;
if ($i % 4 == 0) {
echo '</div>';
$next_item = true;
}
$i++;
}
?>
</div>
<a data-slide="prev" href="#myCarousel" class="left carousel-control">‹</a>
<a data-slide="next" href="#myCarousel" class="right carousel-control">›</a>
</div>
The JS that needs to go with this is as following
<script>
$(document).ready(function(){
$('#myCarousel').carousel({
pause: true,
interval: false
});
});
$('#myCarousel').on('slid', '', function() {
var $this = $(this);
$this.find('.carousel-control').show();
if($('.carousel-inner .item:first').hasClass('active')) {
$this.find('.left.carousel-control').hide();
} else if($('.carousel-inner .item:last').hasClass('active')) {
$this.find('.right.carousel-control').hide();
}
});
</script>
Updated:
As per the way Bootstrap 2.3 carousel works, multiple items like the way you have done won't show 4 items in a row and only one .item class can have an .active class to it, so here's what we would do:
<div class="item active">
<div class="span3"><img></div>
<div class="span3"><img></div>
<div class="span3"><img></div>
<div class="span3"><img></div>
</div>
<div class="item">
<div class="span3"><img></div>
<div class="span3"><img></div>
<div class="span3"><img></div>
<div class="span3"><img></div>
</div>
That's how we are going to structure your elements to look like. So code in:
<!-- code follows -->
<div class="carousel-inner">
<?php
$i = 1;
$next_item = true;
while ($i < 10)
{
if ($i == 1)
{
echo '<div class="item active">';
}
elseif ($next_item == true)
{
echo '<div class="item">';
}
?>
<div class="span3 mef-3">
<!-- code follows -->
</div>
<?php
$next_item = false;
if ($i % 4 == 0)
{
echo '</div>';
$next_item = true;
}
$i++;
}
?>
Also, since you name your carousel as id=myCarousel, your prev and next button's href should be href="#myCarousel" and not href="#textCarousel".
Here's a demo of what it looks like.
Is there anyone who try out bootstrap slide with opencart slideshow module?
Here is my code i am trying but getting all active classes. Someone can help me plz.
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<div class="carousel-inner slideshow <?php echo $module; ?>">
<div class="item active">
<?php foreach ($banners as $banner) { ?>
<?php if ($banner['link']) { ?>
<img src="<?php echo $banner['image']; ?>" alt="<?php echo $banner['title']; ?>" />
<?php } else { ?>
<img src="<?php echo $banner['image']; ?>" alt="<?php echo $banner['title']; ?>" />
<?php } ?>
<?php } ?>
</div>
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
UPD: loop must be like this
<div class="carousel slide" data-ride="carousel">
<div class="carousel-inner slideshow<?php echo $module; ?>">
<?php foreach ($banners as $banner) { ?>
<?php if ($banner['link']) { ?>
<div class="item"><img src="<?php echo $banner['image']; ?>" alt="<?php echo $banner['title']; ?>" /></div>
<?php } else { ?>
<div class="item"><img src="<?php echo $banner['image']; ?>" alt="<?php echo $banner['title']; ?>" /></div>
<?php } ?>
<?php } ?>
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"><span class="bootstrap_left"></span></a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next"><span class="bootstrap_right"></span></a>
</div>
</div>
and jquery
<script type="text/javascript"><!--
$(document).ready(function() {
$('.item:first-child').addClass('active');
$('.carousel').carousel();
});
--></script>
As you can see in your 3rd line you have
<div class="item active"> .
You need to include this inside the loop of your php.
Then create a condition that if it is the first item, set its class as item active and then in your else statement just item.
Try work it out with this example code.
<?php $i = 1; ?>
<?php foreach ($rows as $row): ?>
<?php $item_class = ($i == 1) ? 'item active' : 'item'; ?>
<div class="<?php echo $item_class; ?>">
<a href="<?php echo $row['url']; ?>">
<img src="<?php echo $row['image']; ?>" alt="<?php echo $row['title']; ?>" />
</a>
</div>
<?php $i++; ?>
<?php endforeach; ?>
Have you refer or check the html version outputted of your code. If simillar
to what should bootstrap carousel setup should be?
Please do refer with it . BOOTSTRAP CAROUSEL
Else refer to this fiddle JSFIDDLE DEMO
Carousel Script
// invoke the carousel
$('#myCarousel').carousel({
interval: 3000
});
/* SLIDE ON CLICK */
$('.carousel-linked-nav > li > a').click(function() {
// grab href, remove pound sign, convert to number
var item = Number($(this).attr('href').substring(1));
// slide to number -1 (account for zero indexing)
$('#myCarousel').carousel(item - 1);
// remove current active class
$('.carousel-linked-nav .active').removeClass('active');
// add active class to just clicked on item
$(this).parent().addClass('active');
// don't follow the link
return false;
});
/* AUTOPLAY NAV HIGHLIGHT */
// bind 'slid' function
$('#myCarousel').bind('slid', function() {
// remove active class
$('.carousel-linked-nav .active').removeClass('active');
// get index of currently active item
var idx = $('#myCarousel .item.active').index();
// select currently active item and add active class
$('.carousel-linked-nav li:eq(' + idx + ')').addClass('active');
});
Manchary had the right idea. I have tested this, and run it in my Opencart.
Here's the full code to add to:
catalog/view/theme/yourtheme/template/module/carousel.tpl
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<?php
$i = 0;
foreach ($banners as $banner) {
echo "<li data-target=\"#myCarousel\" data-slide-to=\"".$i."\" class=\"indicator\"></li>\n";
$i++;
}
?>
</ol>
<!-- slides -->
<div class="carousel-inner">
<?php foreach ($banners as $banner) { ?>
<?php if ($banner['link']) { ?>
<div class="item"><img src="<?php echo $banner['image']; ?>" alt="<?php echo $banner['title']; ?>" /></div>
<?php } else { ?>
<div class="item"><img src="<?php echo $banner['image']; ?>" alt="<?php echo $banner['title']; ?>" /></div>
<?php } ?>
<?php } ?>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($){
$('#myCarousel ol.carousel-indicators li:first').addClass('active');
$('#myCarousel .item:first').addClass('active');
$('#myCarousel').carousel({
interval: 8000
});
});
//]]>
</script>
Note* If jQuery document ready is causing grief, you can try
window.onload = function() {
// code here
}
Hope this helps someone.
geeks please help,
I have a problem with the usage of array keys with the while loop.
I'm trying to display the twitter bootstrap slider images by looping from the database with this code:
<div id="slider">
<!--Code for make home images slide show-->
<div id="myCarousel" class="carousel slide">
<!-- here comes the engine to run the sliders -->
<?php
$query = 'SELECT * FROM banners WHERE status = 1 ORDER BY id ASC';
?>
<div class="carousel-inner">
<?php
if ($r = mysql_query($query , $conn)) { //run the query
$row = mysql_fetch_array($r);
reset($row);
while (list($key, $value) = each($row)) {
if ($key == 0) { ?>
<div class="item active">
<img src="images/homeimages/<?php echo $value['image'];?>" alt="<?php echo $value['title'];?>">
<!-- <img src="images/homeimages/one.jpg" alt=""> -->
<div class="carousel-caption">
<!-- <h4>First Thumbnail label</h4> -->
<p><i><?php echo $value['title'];?></i></p>
</div>
</div>
<?php }else{ ?>
<div class="item">
<img src="images/homeimages/<?php echo $value['image'];?>" alt="<?php echo $value['title'];?>">
<!-- <img src="images/homeimages/one.jpg" alt=""> -->
<div class="carousel-caption">
<!-- <h4>First Thumbnail label</h4> -->
<p><i><?php echo $value['title'];?></i></p>
</div>
</div>
<?php }
}
}else {
print '<p style="color: red;">Could not retrieve the slider:<br />' . mysql_error($dbc) . '.</p>';
} ?>
</div>
<!-- <a class="left carousel-control" href="#myCarousel" data-slide="prev">‹</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">›</a> -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
</div>
</div><!-- endof slider -->`
.
as`it's well known the first slider image of twitter bootstrap must have the class of active to make sure it loads faster. I need to pick the first slider image from an array and add the class of active into it while the rest of the slider images remains the same without an active class.
can someone please tell me where i'm messing up with my codes?
Try this:
<div class="carousel-inner">
<?php
if ($r = mysql_query($query , $conn)) {
$count = 0;
while ($row = mysql_fetch_array($r){
if ($count == 0){?>
<div class="item active">
<?php}
else { ?>
<div class="item">
<?php}?>
<img src="images/homeimages/<?php echo $row['image'];?>" alt="<?php echo $row['title'];?>">
<div class="carousel-caption">
<p><i><?php echo $row['title'];?></i></p>
</div>
</div>
<?php
}
$count ++;
}
}
else {
print '<p style="color: red;">Could not retrieve the slider:<br />' . mysql_error($dbc) . '.</p>';
}