Question: The below code add as yes if the master class text box value matches with the user but i want to compare the master with the user class and print the number count result in a div of how many input user class have the same repeated value of as master has.

Html:

```
<input class="master" value="1">
<input class="user" value="1">
<input class="user" value="1">
<input class="user" value="0">
<input class="user" value="0">
                    <div id="result_count"></div>

```

Javascript:

```
$(function() {
  var master = $('input.master').get(0).value; // get the master value
  var fn = function() {
    return this.value === master ? "yes" : "no";//if current text-box matches master,then yes else no
  };
  $('input.user').val(fn); // loop and replace text for each user input
});

```

Answer: 
You should simply execute the query, e.g. :

```
$rating = VehicleRating::find()->where(['vehicle_id' => $id])->one();
echo $rating->vehicle_rating;

```

Or if you want array instead of object :

```
$rating = VehicleRating::find()->where(['vehicle_id' => $id])->asArray()->one();
echo $rating['vehicle_rating'];

```

Read more : <http://www.yiiframework.com/doc-2.0/guide-db-active-record.html#querying-data>
found the solution i added ->one() at the end of query and it works

```
$data = VehicleRating::find()->where(['vehicle_id' => $id])->one();

```