I want to count the occurence of like and unlike in the array.  

`$content` is either `{"userid":"1","like":"1"}` or `{"userid":"1","unlike":"1"}`.  

I want to count like and unlike records in table.
For my table I need to display `like_count=3` and `unlike_count=1`. 
Now It displays `like_count=5` and `unlike_count=5`. 

[![enter image description here](https://i.stack.imgur.com/WtZVw.png)](https://i.stack.imgur.com/WtZVw.png)

```
$like_count=0;
$unlike_count=0;
 while($like_fet=mysql_fetch_assoc($query))
 {
  $content = $like_fet['CONTENT_VALUE'];
  $datas = json_decode($content);
  foreach($datas as $item)
  {
   $like=$item['like'];
   if($like=='1')
    {
    echo "like";   
    $like_count=$like_count+1;  
    }
   $unlike=$item['unlike'];
   if($unlike=='1')
    {
    echo "unlike";
    $unlike_count=$unlike_count+1;  
    }
  }

 }
  echo "like_count=".$like_count;
 echo "unlike_count=".$unlike_count;

```