Jump to content

Calculating Against SQL Database, returing Values


cjbeck71081

Recommended Posts

I was interested in trying to calculate against an SQL Table and return values that matched within the calculation.  What i am trying to put together is a Zip Code Locator.  I have a table "AREA" of Lat, Long and Zip Code numbers for the area im interested in.  I also have a table "LOCATIONS" of Lat, Long and Zip code numbers for 25 different locations with data about Store Name, Address, etc.

 

What i would like to do is have a user input thier Zip code and that would launch one query, which would pull down the Lat & Long from the table "AREA".  I would like to then Query the database "LOCATIONS" and calculate the distance between them using a formula. So it would do this.

 

User submit--->$_POST['zip'];---->Query and bring down LAT, LON from "AREA" table--->Query the LOCATIONS table, bring down all values---->calculate LAT, LON, from AREA table minus LAT, LON from the LOCATIONS table and populate to Variables the values that were LESS THAN 5 or something.

 

I hope this made sense. Sorry it was written quickly.

 

Even a tutorial that is similar, might allow me to utilize some of the same ideas to make this happen.

 

Thanks

Chris

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.