zace66 Posted November 30, 2014 Share Posted November 30, 2014 I have a website of grids of webcam images. I have decided to make a looping webpage where I want just 1 image per page and every 2 seconds moves on to the next image. I have the following code - but it only gets 1 image. I was going to update the database record with the next image but have decided it will be easier to get an array and loop round that somehow. Normally when I loop its easy to display the results in a table but this time i want it to display 1 image (record) at a time then move on... The code below works fine (only showing the first image form the website in my database) I hope someone can help me out please. TIA <html> <head> <title>My webcam page </title> </head> <?php $host = 'localhost'; $user = 'my_User'; $pass = 'my_Password'; $db = 'my_db'; $con = mysqli_connect($host, $user, $pass, $db) or die(mysqli_connect_error()); $sql = "SELECT * FROM `websites` WHERE `currentshowing`=1 LIMIT 0, 30 "; $result = mysqli_query($con,$sql); if (!$result) { die("Error: Data not found.."); } $test = mysqli_fetch_array($result); $webpic=$test['webpic']; $basesite=$test['basesite']; $location=$test['location']; ?> <div align="center"> <h1>MY WEBSITE (Ongoing work)</h1> </div> <td><div align="center"><?PHP echo $location; ?><br> <a href="<?PHP echo $basesite; ?>"> <img src="<?PHP echo $webpic; ?>" alt="<?PHP echo $location; ?>" width="80%" border="0"/> </a></div></td> </body> </html> Quote Link to comment Share on other sites More sharing options...
QuickOldCar Posted November 30, 2014 Share Posted November 30, 2014 The easiest way to do it would be using a jquery slideshow Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.