Jump to content

Not sure where to ask this but - PHP Zip Code Locator ??


spacepoet

Recommended Posts

Hello:

 

I'm not sure where to ask this so I figured this is a good place.

 

I have to build a zip code locator that will find businesses within a selected radius. Also, I need to create the admin side to add towns, and stores to the site.

 

I don't want to buy any already existing system (unless it's one that is very similar to what I need to build - but I think it's pretty straightforward).

 

Also, I purchased a zip code database, but it is in Access 2003 - is that easy to convert/import to a .sql / mySQL database?

 

Thanks.

 

Link to comment
Share on other sites

Also, I purchased a zip code database, but it is in Access 2003 - is that easy to convert/import to a .sql / mySQL database?

 

That depends entirely on your skill level, I would say yes though.

 

As for the rest of your post, do you have a question?

Link to comment
Share on other sites

Hi:

 

I wanted to know if there is a tutorial section on here, or if someone knows of a tutorial that will explain how to make a Zip Code Locator like the one I need.

 

My GOOGLE searches keep bringing up systems for sale, and I want to make one from scratch.

 

Any ideas?

 

Thanks.

 

PS - Access 2 mySQL: Is this merely exporting as a .CSV file, and importing to mySQL? I'm basically trying to figure out the best way to take it out of Access and add it to an already existing mySQL database.

Link to comment
Share on other sites

OK, I think I found a tutorial for the Zip Locator itself:

http://htmlcampus.com/build-a-zip-code-store-locator-application-in-php/

 

However, there is an error on the demo of it, so let me try it on my server and see.

 

But, can you clarify the Access to mySQL ??

 

Also, I think I will need some points on how to make the admin part, but let me do this one step at a time.

 

Thanks.

Link to comment
Share on other sites

OK, I'm am stuck on this.

 

I have my Access Zipcode database exported as a .TXT file.

 

The data looks like this:

"00501",40.92,-72.63,"HOLTSVILLE","NEW YORK","NY"
"00544",40.92,-72.63,"HOLTSVILLE","NEW YORK","NY"
"00601",18.16,-66.72,"ADJUNTAS","PUERTO RICO","PR"
"00602",18.39,-67.18,"AGUADA","PUERTO RICO","PR"
"00603",18.45,-67.14,"AGUADILLA","PUERTO RICO","PR"
Etc...

 

I want to imported it into my mySQL database.

 

I'm trying to use this code:

CREATE TABLE `zip_codes` (
  `zip_id` INT(11) NOT NULL AUTO_INCREMENT,
  `zip` VARCHAR(5) NOT NULL DEFAULT '',
  `lat` VARCHAR(10) NOT NULL DEFAULT '',
  `lon` VARCHAR(10) NOT NULL DEFAULT '',
  `city` VARCHAR(50) DEFAULT NULL,
  `full_state` VARCHAR(50) DEFAULT NULL,
  `abbr_state` char(2) NOT NULL DEFAULT '',
  PRIMARY KEY  (`zip_id`),
  UNIQUE KEY `zip` (`zip`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

 

It's from a test database that has some zipcodes in it (but it's not full):

CREATE TABLE `zip_codes` (
  `zip_id` INT(11) NOT NULL AUTO_INCREMENT,
  `zip` VARCHAR(5) NOT NULL DEFAULT '',
  `lat` VARCHAR(10) NOT NULL DEFAULT '',
  `lon` VARCHAR(10) NOT NULL DEFAULT '',
  `city` VARCHAR(50) DEFAULT NULL,
  `full_state` VARCHAR(50) DEFAULT NULL,
  `abbr_state` char(2) NOT NULL DEFAULT '',
  PRIMARY KEY  (`zip_id`),
  UNIQUE KEY `zip` (`zip`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

INSERT INTO `zip_codes` (`zip`, `abbr_state`, `lat`, `lon`, `city`, `full_state`) VALUES ('35004', 'AL', '33.606379', '-86.50249', 'Moody', 'Alabama');
INSERT INTO `zip_codes` (`zip`, `abbr_state`, `lat`, `lon`, `city`, `full_state`) VALUES ('35005', 'AL', '33.592585', '-86.95969', 'Adamsville', 'Alabama');
INSERT INTO `zip_codes` (`zip`, `abbr_state`, `lat`, `lon`, `city`, `full_state`) VALUES ('35006', 'AL', '33.451714', '-87.23957', 'Adger', 'Alabama');
INSERT INTO `zip_codes` (`zip`, `abbr_state`, `lat`, `lon`, `city`, `full_state`) VALUES ('35007', 'AL', '33.232422', '-86.80871', 'Alabaster', 'Alabama');
Etc...

 

How do I import and create the "zip_codes" table?

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.