/var/www/hkosl.com/dirsignage_old/html/ajax_rolling_text.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
    
include_once ("webadmin/configure.php");

    
$lastupdate_string $_POST["lastupdate_string"];

    
$sql "select * from rolling_text ";
    
$parameters = array();
    if (!(
$sth $dbh->prepare($sql))) {
        throw new 
Exception('[' $sth->errorCode() . ']: ' print_r($sth->errorInfo()));
    }

    if (!
$sth->execute($parameters)) {
        throw new 
Exception('[' $sth->errorCode() . ']: ' print_r($sth->errorInfo()));
    }

    
$all_rolling_text_info $sth->fetchAll();

    
$real_lastupdate_string "";
    foreach(
$all_rolling_text_info as $rolling_text_info){
        
$real_lastupdate_string .= $rolling_text_info{"lastupdate"}." ";
    }

    if(
$lastupdate_string != $real_lastupdate_string){

        
$new_rolling_text  "";
        foreach(
$all_rolling_text_info as $rolling_text_info){
            
$new_rolling_text .= "<li>".$rolling_text_info{"content_en"}."</li>";
        }

        echo 
$new_rolling_text;
    }else{
        echo 
"2";
    }
?>