I have one TV Dashboard (without touch). I want to display some information dynamically from database PHP/MySQL. But here is a problem: when table rows exceed the height of screen i want to display automatically a second page and after 10 sec i want to auto go back on first page. All in loop mode. It is that possible?
Thank you.
I have code like this:
<table class="table">
<thead>
<tr>
<th id="th_left">Ticket ID</th>
<th id="th_left">Device Model</th>
<th id="th_left">Client Name</th>
</tr>
</thead>
<?php
for ($j=0; $j<count($to_display_list); $j++) {
$a = $to_display_list[$j]->status_id;
?>
<tbody>
<tr>
<td><strong><?php echo $to_display_list[$j]->ticket_id ?></strong></td>
<td><strong><?php echo $to_display_list[$j]->device_model ?></strong></td>
<td><strong><?php echo $to_display_list[$j]->client_name ?></strong></td>
</tr>
</tbody>
<?php
}
?>
</table>
Can you help me please?
In <head>
place this:
<?php
// connect to database here and do what you need to get the variable $to_display_list
if(count($to_display_list)>=30){
$page = $_GET['p'];
if($page == "1"){
echo '<meta http-equiv="refresh" content="10; url=page.php?p=2">'; // replace page.php with your file name
}else{
echo '<meta http-equiv="refresh" content="10; url=page.php?p=1">'; // replace page.php with your file name
}
}else{ // less than 30 items, only display one page
echo '<meta http-equiv="refresh" content="10">';
}
?>
Then replace the part of the code you have above with:
<table class="table">
<thead>
<tr>
<th id="th_left">Ticket ID</th>
<th id="th_left">Device Model</th>
<th id="th_left">Client Name</th>
</tr>
</thead>
<?php
if(count($to_display_list)>=30){
if($page == "1"){
for ($j=0; $j<count($to_display_list)/2; $j++) {
$a = $to_display_list[$j]->status_id;
}else{
for ($j=count($to_display_list)/2; $j<count($to_display_list); $j++) {
$a = $to_display_list[$j]->status_id;
}
}else{ // less than 30 items to display
for ($j=0; $j<count($to_display_list); $j++) {
$a = $to_display_list[$j]->status_id;
}
?>
<tbody>
<tr>
<td><strong><?php echo $to_display_list[$j]->ticket_id ?></strong></td>
<td><strong><?php echo $to_display_list[$j]->device_model ?></strong></td>
<td><strong><?php echo $to_display_list[$j]->client_name ?></strong></td>
</tr>
</tbody>
<?php
}
?>
</table>
This uses the GET-method and meta refresh to update the page URL to ?p=1 or ?p=2 and reads a different part of the display list dependning on the page.
It will display half of the data on "page 1" and the other half on "page 2".