Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Gdn::SQL Changing Up my Select query [RESOLVED]
odannyc
New
I'm trying to do this:
$Sql->select("findDistance(addresslatitude,addresslongitude, 34.11111111 -100.00000001) distance");
findDistance is a function inside of mysql I created, so that works just fine.
The only problem I'm having is, that select string is throwing an error with :
Incorrect parameters in the call to stored function 'findDistance'
And right below that I'm seeing it changes it to this:
'select *, findDistance(addresslatitude, addresslongitude, 34.1111 as 1111, -118.3695699) as distance
The problem is this: 34.1111 as 1111
Anyone have an idea on how to fix this?
0
Comments
@R_J @hgtonight ,
Any idea? I tried looking into class.sqldriver.php but didn't want to mess with it.
EDIT:
This is the code that seems to be giving decimals in select method aliases, might be a bug?
NEVERMIND,
Found the solution:
$Sql->select("AddressLatitude,AddressLongitude,{$Lat},{$Lng}", 'findDistance', 'distance');
Turns out that select takes in 3 parameters.
The second is the function you want to wrap the first parameter in and the third parameter is the alias.
Awesome, glad you found the answer to your own question.