Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function s_p() {
- $sql = "SELECT COUNT(*) FROM `poll` WHERE `status`='active'";
- $result = Db::sql($sql);
- $row = mysql_fetch_row($result);
- $total = $row[0];
- return $total;
- }
- public function u_p(){
- $sql = "UPDATE `poll` SET `status`='active' WHERE `id` = '{$this->id}'";
- $result = Db::sql($sql);
- return true;
- }
- if($poll->id =(int)$_GET['poll_a']) {
- if ($poll->s_p() > 0) {
- echo "Есть активный опрос";
- } else {
- $poll->u_p();
- }
- }
Add Comment
Please, Sign In to add comment