使用mysql无法正常工作的Laravel中的距离查询

时间:2014-04-16 12:03:14

标签: php mysql laravel-4

我正在尝试选择距离资产10公里范围内的所有住宅的ID。

  • 资产坐标存储在Eastings / Northings参数中。

不幸的是我收到了这样的错误:

Symfony \ Component \ Debug \ Exception \ FatalErrorException syntax error, unexpected '?> ', expecting function (T_FUNCTION)

public function postAnalysis(){

$relevant_home = Input::get('relevant_homes');

$asset = Home::where('Home_name', '=' , $relevant_home)->first();

echo $asset->Eastings;
echo $asset->Northings;


$competitors = Home::select('SELECT SQRT(POW($Eastings - `Eastings`,2) + POW($Northings - `Northings`,2)) as distance FROM homes HAVING distance <=10 ORDER BY distance ASC', array('competitors'))->get();
echo $competitors;

}

请解决我的问题。

0 个答案:

没有答案