Jump to content

jakebur01

Members
  • Posts

    885
  • Joined

  • Last visited

About jakebur01

  • Birthday 06/23/1986

Profile Information

  • Gender
    Male
  • Location
    USA

jakebur01's Achievements

Advanced Member

Advanced Member (4/5)

2

Reputation

1

Community Answers

  1. Disregard that. The array of zip codes is in the correct order. It's my IN() in the mysql query I'm using to pull the users within those zip codes that throwing it out of order. $sql = "SELECT * FROM `users` WHERE `ZIPCODE` IN($List)"; I changed it to: SELECT * FROM `users` WHERE `ZIPCODE` IN($List) ORDER BY FIELD(ZIPCODE, $List) It's working now! Thanks Kicken and to everyone else that helped.
  2. Hey Kicken, it’s pulling the zip codes now but not sorting by distance.
  3. Thanks, but I’d rather solve this and pull from my own database.
  4. $sql = ' SELECT DISTINCT zip FROM ( SELECT zip, (3958*3.1415926*sqrt((latitude-?)*(latitude-?) + cos(latitude/57.29578)*cos(?/57.29578)*(longitude-?)*(longitude-?))/180) as distance FROM zip_codes ) r WHERE r.distance < ? ORDER BY r.distance '; $stmt = $this->db->prepare($sql); $stmt->bind_param('dddddd', $zip->latitude, $zip->latitude, $zip->latitude, $zip->longitude, $zip->longitude, $radius); $stmt->bind_result($rowZip); $stmt->execute(); $zip_codes = []; while ($stmt->fetch()){ $zip_codes[] = $rowZip; } return $zip_codes;
  5. Hey, that listed them. Although, they are still not listed by nearest. They are all random.
  6. What is it looking for? Is it thinking that is a function, or looking for a database table?
  7. Fatal error: Uncaught mysqli_sql_exception: FUNCTION imsafe.zip does not exist in /home/zipclass.php:99 Stack trace: #0 /home/zipclass.php(99): mysqli->prepare('\n SELECT...') #1 /home/zipclass.php(34): ZipCodeUtility->get_zipcodes_by_radius(Object(stdClass), 100) #2 /home/TOOL_zipcodetest.php(45): ZipCodeUtility->search_radius(71075, 100) #3 {main} thrown in /home/zipclass.php on line 99 imsafe is the name of the database the table is zip_codes
  8. Fatal error: Uncaught Error: Call to a member function bind_param() on boolean
  9. How can I order this query of zip codes within the radius by nearest? /** * Get Zipcode By Radius * @param string $zip US zip code * @param ing $radius Radius in miles * @return array List of nearby zipcodes */ protected function get_zipcodes_by_radius ( $zip, $radius ) { $sql = 'SELECT distinct(zip) FROM zip_codes WHERE (3958*3.1415926*sqrt((latitude-'.$zip->latitude.')*(latitude-'.$zip->latitude.') + cos(latitude/57.29578)*cos('.$zip->latitude.'/57.29578)*(longitude-'.$zip->longitude.')*(longitude-'.$zip->longitude.'))/180) <= '.$radius.';'; $zip_codes = array(); if ( $result = $this->db->query( $sql ) ) { while( $row = $result->fetch_object() ) { array_push( $zip_codes, $row->zip ); } $result->close(); } return $zip_codes; }
  10. Nevermind. I figured it out. You make your links to your page as the friendly links and htaccess reads and converts the seo friendly link or directs it to the appropriate page.
  11. Ok. My input is https://www.test.com/listings.php?ident=TEST&facility=library. I'd like the output to be: https://www.test.com/TEST/LIBRARY. I'd like to make my urls seo friendly.
  12. I'm attempting to rewrite my urls but don't seem to be getting it to work. I've tried: RewriteEngine On RewriteRule /(.*)/(.*)/$ listings.php?ident=$1&facility=$2 And I've also tried: RewriteEngine On RewriteRule ^([^/\.]+)/([^/\.]+)?$ listings.php?ident=$1&facility=$2 Any suggestions?
  13. Of course, these same users will need to be able to edit and or add some directory listings. I can try to build it from scratch, but it sure would save me a lot of time if there is something already out there I could implement.
  14. I have an idea for a site that is sort of like a directory which I already have built. I'd like to incorporate some social media into it allowing each directory listing to get comments and star ratings. I don't like envato/code canyon packaged sites. I'd rather be flexible and mostly use all of my own code. However, I have seen a star rating class on phpclasses, but I have not come across a user/comment class or script yet that I can customize into my directory listings. If I can find a class I can add on to my site that already has a user profile, and all of the ajax and css for commenting/rating, I would use if it I could customize it into the site I already have. I'd just rather not use an entire social media site someone has built then try to add my code and pages into it and have to depend on the developer for support. Does anyone know of any rating/commenting classes or have any suggestions?
  15. Yea. I guess I could add a button to the landing page. Click here to activate.
×
×
  • 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.