Guest User

Untitled

a guest
Jul 19th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.50 KB | None | 0 0
  1.         public function s_p() {
  2.             $sql = "SELECT COUNT(*) FROM `poll` WHERE `status`='active'";
  3.             $result = Db::sql($sql);
  4.             $row = mysql_fetch_row($result);
  5.             $total = $row[0];
  6.             return $total;
  7.         }
  8.         public function u_p(){
  9.             $sql = "UPDATE `poll` SET `status`='active' WHERE `id` = '{$this->id}'";
  10.             $result = Db::sql($sql);
  11.             return true;
  12.         }
  13.  
  14.  
  15.     if($poll->id =(int)$_GET['poll_a']) {
  16.         if ($poll->s_p() > 0) {
  17.             echo "Есть активный опрос";
  18.         } else {
  19.             $poll->u_p();
  20.         }
  21.     }
Add Comment
Please, Sign In to add comment