Jump to content

zipcode search


timtom3

Recommended Posts

Hi ppl

 

I have discovered a major flaw in my website, when I do a search on a post/zipcode it only picks up the zipcodes that are in the property table. I have another table called zipcodes which contains all the zipcodes of the area.

 

What should happen is that a user should enter their own zipcode (this zipcode is already stored in zipcode table) and it can find properties around that the users zipcode.

 

At the moment you have to enter a zipcode that is in the property table and it finds the properties from there, which is wrong.

 

Its either SQL1 or SQL3 but I can't see where I should alter or add. I know I haven't entered zipcode table anywhere but not sure where to put it.

 

Code Here

 

case 'none':

$sql_3 = "SELECT * FROM property p, cmstype t WHERE

SQRT( (69.1 * (".$userLat." - p.latitude)) * (69.1 * (".$userLat." - p.latitude))

+ (53.0 *(".$userLong." - p.longitude)) * (53.0 *(".$userLong." - p.longitude)))

 

I think userlat and userlong need to be the ones from Zipcode table but it doesn't return any results when I change SQL 1 to Zipcodes

Link to comment
https://forums.phpfreaks.com/topic/2620-zipcode-search/
Share on other sites

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.