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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.