entry id | crop id | price
-------------------------------
1 | 3 | 90.00
2 | 3 |100.00
With this code: if $crop_id = 3
$price=Price::model()->find('crop_id = :cropId', array( ':cropId' => $cropId ) );It only returns the field of the first row. 1 | 3 | 90.00
With this code:
$price=Price::model()->findAll('crop_id = :cropId', array( ':cropId' => $cropId ) );
It returns all the field of the crop_id = 3
thus returning 1 | 3 | 90.00 and 2 | 3 | 100.00
If it is true, how can I price[0] or price[1]?? Because it spouts an error.