Reputation: 6186
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 ?
Upvotes: 0
Views: 74
Reputation: 1659
You can always use string concatenation:
<?php
mysql_query('SELECT getDistance('.$a.', '.$b.', '.$b.', '.$b.')');
?>
Upvotes: 0
Reputation: 91017
While I find this structure quite strange, and feel curious about why someone would implement such things in MySQL, the way it should work is with
mysql_query(sprintf("select getDistance(%d,%d,%d,%d)", $a, $b, $c, $d);
Upvotes: 4