Query working on localhost and not live server

I have a query I had to rewrite due to client moving servers. My function that worked fine on mysql did not work on MAriaDB which was what new server had. Thanks goodness for custom queries that were added to Wappler recently.

My custom query calculates distances between location selected on a page and the employers display in the results sorted by nearest to selected location to furthest.

Everything works fine on my local server that uses the live db, but the query does not “get” the lat and long values to make a calculation on the live server. I have checked that needed files are uploaded, but somewhere something is weirdly wrong. This site started on app connect/server connect on Dreamweaver and made the migration to Wappler for updates over the past 2+ years.

here is the page in question with the params already filled in the url:


it is used with South African locations.

The result from distanceResults.php shows Unable to connect database: Connection refused. Seems there is a problem with the database connection.

The message ‘Connection Refused’ has two main causes:

  1. Nothing is listening on the IP:Port you are trying to connect to.
  2. The port is blocked by a firewall.

Sorry @patrick - that seems to be some old code we were calling that I forgot to comment out - the server action in question is distancesearch.php.

1 Like

So what is the problem with it? Checking https://suitup.work/dmxConnect/api/search/distancesearch.php?lat=-26.2041028&lon=28.047305100000017 it seems to return a lot of results.

So the query runs fine on my localhost. What it does:

Get lat and lon coordinates from two hidden fields that the google autocomplete fills. Calculates distance between all the employers and sorts them from closest to furthest. Seems like it does not use the Get variables on the live server and is then not able to do the calculations. are there any files I maybe missed in my upload generated by the custom query on server connect? File attached.

distancesearch.php.zip (1.9 KB)

So on live server where you see values, calc was not done with the get vars and it is not sorted as per the server connect action.

How can I see that it is not working, for me the site looks like it is working.

Ok, seems like all my writing apparently does not explain that the results are different between local and live. Is there anything else I can provide or explain to help you understand that the results live are wrong in that they are not sorted because calculation on custom query is not doing what it should?

I don’t know what the results should be, I only notice that it is returning results. I also see distance being filled in the results from the server connect call.


Here are the results on my localserver - distance is calculated correctly and sorted from nearest to furthest:

Here are the results on the live server. Calculations not happening correctly but still sorting:

Both use the same MariaDB

I uploaded all files on these folders:


Do you think there is anything I am missing?

I added 2 set values to make sure the get vars are sent to server connect from fron t en di and that is working fine:


If you think get vars (hidden fields) are not being used / set correctly why not put them in two setvalue steps to see what they return in the dev tools when the server action runs?

1 Like

just tested and uploaded - works fine

Ok so the get vars are passed to the server action properly?
If so, please check your calculation function/custom query then.

The calculation works on local with same db as the live db - so I am not sure how to check and what to check…?

How and where are you calculating these?

in a custom query in server action - the zip file is included earlier in thread

te fact that I left my test values in the custom query for the get vars shouldn’t effect it?

Not sure what you mean? Aren’t you using the get variable values? What are these test values you are referring to?

just there where you can input test values and press play to see results

also just checked - live server on php 5.6

local on 7.3.1

Could that effect the server action?