Php Sqlite acos function

Php Sqlite acos function



In Laravel I've got a query builder method for ordering items based on
the users location with long and latitude.


Laravel


long


latitude



It looks like this:


public function location($location)

$location = explode(',', $location);

$lat = $location[0];
$long = $location[1];

return $this->builder->select(DB::raw(sprintf('(
6371 * acos (
cos ( radians(%s) )
* cos( radians( lat ) )
* cos( radians( lng ) - radians(%s) )
+ sin ( radians(%s) )
* sin( radians( lat ) )
)
) AS distance', $lat, $long, $lat)))
->orderBy('distance');



The problem is that I use a sqlite database. And acos is not supported. How could I get this to work with sqlite?


acos



Already saw this but this is not for php I guess?



acos function in Sqlite




0



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)