I have designed a function in mysql to calculate distance between two coordinates.
function is like this:-
getDistance(arg1,arg2,arg3,arg4)
{
//calculate distance
return distance;
}
now in my php file, i have these four argument to pass in this function.
but i dont know how can i call this function. please tell me how can call this function ?
虽然我发现这种结构很奇怪,并且对为什么有人会在MySQL中实现这些东西感到好奇,但它的工作方式是
mysql_query(sprintf("select getDistance(%d,%d,%d,%d)", $a, $b, $c, $d);
像这样select getDistance(1,2,3,4)
You can always use string concatenation:
<?php
mysql_query('SELECT getDistance('.$a.', '.$b.', '.$b.', '.$b.')');
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.