At where clause i am getting one id on $values variable, while there are four id exist in $rest\_id. How to fix this problem that i could get all the four ids in where clause. Anyone please help to fix this issue please. p.

```
foreach ($rest_id as $value) 
{
$ids = array($value->id);
$nearest_rest = "SELECT *, (3956 * 2 * ASIN(SQRT( POWER(SIN(( 28.5812674 - lat) * pi()/180 / 2), 2) +COS( 28.5812674 * pi()/180) * COS(lat * pi()/180) * POWER(SIN(( 77.3181059 - lng) * pi()/180 / 2), 2) ))) as distance 
                   FROM restaurant_details 
                  WHERE id In ('" . implode("','",$ids) . "') 
                 HAVING distance 
               ORDER BY distance ASC 
                  LIMIT 1"; 
}

```