function likeAaction() { $likea = new likeA(); if ($_GET) { $set = array($UID = $this->getRequest()->getparam("UID", ""), $AID = $this->getRequest()->getparam("AID", ""), $data = date('Y-m-d h-m-s')); $likea->insertLikeA($set); } }
public function likeAction() { // if($_GET){ $set = array("UID" => $_POST["UID"], "AID" => $_POST["AID"], "time" => date('Y-m-d h:i:s')); //print_r($set); $likeA = new likeA(); $arr = $likeA->getAIDsbyUID($set["UID"]); for ($i = 0; $i < count($arr); $i++) { if ($arr[$i] == $set["AID"]) { exit(0); } //return -1; //can't like the same answer twice } $likeA->insertLikeA($set); $likeANum = $likeA->getLikenumbyAID($set['AID']); $result = "{\"AID\":\"" . $set["AID"] . "\"" . ",\"likenum\":\"" . $likeANum . "\"}"; //echo $arr; $this->view->result = $result; $this->render("like"); }