evilbert Posted March 26, 2011 Share Posted March 26, 2011 Can someone please help me? Scenario: Database table with varying amount of records, these will be displayed on a big screen with no user interaction, updating every set amount of time say 15 seconds. Once new data enters the database the page updates and shows that record. As there is only limited space on the screen i can only show e.g 1 record per page. I setup pagination which splits these records up into separate pages. so if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; }; $start_from = ($page-1) * 1; $query = "SELECT * FROM table ORDER BY id ASC LIMIT $start_from, 1"; // run the query and store the results in the $result variable. $result = $mysqli->query($query) or die(mysqli_error($mysqli)); then output the links $total_pages = ceil($total / 1); for ($i=1; $i<=$total_pages; $i++) { echo "<a href=bigscreen.php?page=".$i.">".$i."</a> "; } This is all working fine and splits the pages and displays the links. Problem: I have been trying to get the page bigscreen.php to automatically loop through the pages that are created e.g 3 records = 3 pages so i want it to load bigscreen.php?page=1 then wait for 15 seconds then update to bigscreen.php?page=2 then 15 seconds then update to bigscreen.php?page=3 then back to bigscreen.php?page=1 and this will continue to do this for the amount of pages created. I have tried various methods but i am struggling. I keep getting a redirect loop error in chrome when i setup my loop. I was thinking of putting the links into an array? but i dont know that will work! Any help or tips would be greatly appreciated! Link to comment https://forums.phpfreaks.com/topic/231758-continuous-looping-through-dynamic-links/ Share on other sites More sharing options...
3raser Posted March 26, 2011 Share Posted March 26, 2011 If I'm correct, I believe PHP won't do the page refreshing/data updating for you. I think you'll need some kind of JavaScript code to do something like that. Link to comment https://forums.phpfreaks.com/topic/231758-continuous-looping-through-dynamic-links/#findComment-1192448 Share on other sites More sharing options...
evilbert Posted March 26, 2011 Author Share Posted March 26, 2011 Thanks Justin, ill have a look into it. Link to comment https://forums.phpfreaks.com/topic/231758-continuous-looping-through-dynamic-links/#findComment-1192653 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.