SHARE
TWEET

Untitled

a guest May 31st, 2017 101 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public function add_rating() {
  2.         $rating = (int) $this->uri->segment(3);
  3.         $resource_id = (int) $this->uri->segment(4);
  4.         if((is_numeric($rating)) && ($rating > 0) && ($rating <= 5)) {
  5.             $res = Doctrine::getTable('Resource')->find($resource_id);       
  6.             $ratings[] = json_decode($res->ratings);
  7. /**use either **/
  8. $result=array_push($ratings,$rating);
  9. /**** OR ***/
  10. $ratings[]=$rating;
  11.             $ratings[] = array_push($rating);
  12.             $res->ratings = json_encode($ratings[]);
  13.             $res->save();
  14.         }
  15.         redirect('/home/show/' . $resource_id);
  16.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top