Mathematical Formulars not functioning properly on mysql provisioning

project id 6c16bd4a-a931-4b2e-bfff-1fbbae26dad5, my msql provisioning with the afore mentioned id, doesnt perform mathematical formulars, particularly the harversine formular, i just retruns an empty set, but everything works fine in the localhost i am developing with, it is paired with a laravel app with project ID 247ea72e-37a7-403e-80a3-26c4acbe4169
10 Replies
Percy
Percy2y ago
Project ID: 6c16bd4a-a931-4b2e-bfff-1fbbae26dad5,247ea72e-37a7-403e-80a3-26c4acbe4169
JustJake
JustJake2y ago
You're gonna need to add way more information than that please What query are you running, what error are you seeing, what are you running locally
Maxxie
MaxxieOP2y ago
ok let me drop a snippet of the query $referenceLatitude = $delivery->pickup_lat; $referenceLongitude = $delivery->pickup_long; $referenceMedium = $delivery->medium; $maxDistance = 10; // Maximum distance in kilometers $earthRadius = 6371; // Earth's radius in kilometers $driver_locations = DB::table('drivers') ->select('live_lat', 'live_long') ->selectRaw(" ($earthRadius * ACOS( COS(RADIANS($referenceLatitude)) * COS(RADIANS(live_lat)) * COS(RADIANS(live_long) - RADIANS($referenceLongitude)) + SIN(RADIANS($referenceLatitude)) * SIN(RADIANS(live_lat)) )) AS distance, id AS driver_id, name,email,phoneNumber,state,address,gender,img,medium ") ->where('availability', '=', 1) ->where('status', '=', 'active') ->where('medium', '=', $referenceMedium) ->having('distance', '<=', $maxDistance) ->orderBy('distance') ->get(); as for the error, none is returned to me, just an empty dataset, whereas locally a collection of results is being returned, it;s the exact same data both locally and on railway... and when i try to use the query console it just says, "a cleint-side exception error has occurer", even a simple select all query fails
JustJake
JustJake2y ago
Are you trying to put this stuff into the Query window? I gotta bet it's probably some escaped character stuff. For anything more than random one off queries, I'd connect to the database using some sort of client
Maxxie
MaxxieOP2y ago
no i just showed you the query cos u asked to see it, i didnt put it into the query console, i connected via my mysql client and same thing still happens, but when i use my localhost conneted to phpmyadmin it works fine, and it was working earlier according to the other guy on the team who tested it too
JustJake
JustJake2y ago
Can you run it locally while connected to the cloud DB using the CLI? Are you using PostGIS or something? Like, what are you running locally...
Maxxie
MaxxieOP2y ago
thing is i have a localhost setip using xampp, so after testing locally i push to github so it can be tested properly over the web as it's an api...on the localhost it returns an object when the query is executed, but returns null on the railway wen
Ray
Ray2y ago
Point your local app to your db on Railway and run the query. var_dump all the variables in between to narrow down what’s giving you a null Check the MySQL version you have locally against what’s on Railway; the functions may perform differently on different versions
Maxxie
MaxxieOP2y ago
on local i use phpmyadmin which is fitted with mariaDb, which is a fork of mysql and is 100% compatible, infact the vey said functionality was working earleir hello
Ray
Ray2y ago
var_dump all the variables in between to narrow down what’s giving you a null
Try this please. It was working earlier on Railway?
Want results from more Discord servers?
Add your server