I have a website retrieving images from database. The database has multiple records (ROWS). I am using while loop to retrieve the records. Every record having three or four imag
I (obviously) won't write you you the whole widget but I'm wailing to give you all you need:
First, you need PHP. I suggest you to learn PDO. It's very easy to use and pretty safe:
Example:
query('SELECT * from FOO') as $row) {
print_r($row);
}
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "
";
die();
}
?>
PDO documentation
Then, use HTML and CSS to style the thing.
Then, you use PHP to generate the HTML.
Then, you will use an javascript setInterval
Example for setInterval
setInterval(function() {
// Do something every 5 seconds
}, 5000);
If you need a different ID for each, the easiest way would be to do this:
$counter = 0;
foreach($foo as $bar){
echo '';
//somecode
$counter++;
}
Tho, I do not recommand using this, you should just give one class to each of them and initiate them all at the same time in jQuery using the selector after
$('.slider').myPlugin({
//Plugins options
})