timtom3 Posted October 6, 2005 Share Posted October 6, 2005 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 Quote Link to comment https://forums.phpfreaks.com/topic/2620-zipcode-search/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.