Page 1 of 1

Mysql slideshow

Posted: Thu Aug 06, 2015 11:25 am
by takisis666
I have created a slideshow using a database. It displays the images and rotates them accordingly. What I can't figure out is how to get the other information to display under the images and only for that image. Here is the code I'm using:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>jQuery Slideshow</title>
        <script type="text/javascript" src="jquery-1.11.3.js"></script>
        <script type="text/javascript">
        $(document).ready(function(){
            $('.fadein img:gt(0)').hide();
            setInterval(function(){
              $('.fadein :first-child').fadeOut()
                 .next('img').fadeIn()
                 .end().appendTo('.fadein');},
              3000);
        });
        </script>
        <style type="text/css">
        .fadein { position:relative; width:500px; height:332px; }
        .fadein img { position:absolute; left:0; top:0; }
        </style>
</head>
   <body>
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');

// Connects to your Database
include("conf.php");

$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_select_db($db) or die ("Unable to select database!");

//Retrieves data from MySQL
$data = mysql_query("SELECT * FROM vehicles") or die(mysql_error());

echo "<div class=\"fadein\">";
while($info = mysql_fetch_array( $data ))
{
    //Outputs the image and other data
    echo "<img src='data:image/jpeg;base64,".base64_encode($info['image'])."'>";
	echo "<br>";
	echo $info['year'];
}
echo "</div>";
?>
</body>
</html>

Re: Mysql slideshow

Posted: Thu Aug 06, 2015 12:36 pm
by Celauran
Rather than targeting the img directly, wrap the image and related content in a div and fade those in/out

Re: Mysql slideshow

Posted: Thu Aug 06, 2015 1:45 pm
by takisis666
And how would I do that. I am fairly new and still learning php.