Guest User

Untitled

a guest
Sep 26th, 2012
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. private function ListComments(){       
  2.     //Fetching my data
  3.     $comments = static::$DB->SelectData("comments", array("username", "message", "date", "last"));
  4.     //Checking if there is something new added
  5.        if($comments[count($comments)-1]["last"] < count($comments)) {
  6.     //Printing all the fetched data
  7.            print json_encode($comments);
  8.     //Updating the "last" column which is used to check if there are new enteries
  9.            static::$DB->UpdateData("comments", array("last" => count($comments)), array("last" => 0));
  10.        } else {  
  11.            print json_encode(array("x"));
  12.            }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment