Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function add_rating() {
- $rating = (int) $this->uri->segment(3);
- $resource_id = (int) $this->uri->segment(4);
- if((is_numeric($rating)) && ($rating > 0) && ($rating <= 5)) {
- $res = Doctrine::getTable('Resource')->find($resource_id);
- $ratings[] = json_decode($res->ratings);
- /**use either **/
- $result=array_push($ratings,$rating);
- /**** OR ***/
- $ratings[]=$rating;
- $ratings[] = array_push($rating);
- $res->ratings = json_encode($ratings[]);
- $res->save();
- }
- redirect('/home/show/' . $resource_id);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement