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