Custom address search for my site

They have: 25 posts

Joined: Nov 2002

I've been asked to add a "search" to this company's website.
This is what their customers will be searching
jakenoble.8m.com/photo5.html .
I need to allow their customers to search by zip code, name, address, or city.
I'm not quite sure how to go about this. Their server doesn't allow complex scriptings.
However, I could host it somewhere else if it takes php or anything else.
Please help. I'm very new to this.
Thanks

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Well ideally you'd have a database and use a scripting language (of which php is one) to do this.

Are they in a database?

They have: 20 posts

Joined: Sep 2003

you can also do some fun stuff with JavaScript here. Your specific application seems simple enough. The first search I ever did was JavaScript Laughing out loud it was fun.

are you interested in this approach? it would not necessarily require server-side scripting, although that would be a nice benefit...

Cold.....so..cold!!!

They have: 25 posts

Joined: Nov 2002

Javascript would work.
Can you tell me how!
(I'd also like to know how to do it in php, but I think my only option would be javascript)
They don't have a database. Can I do it from a plain text file or something? Do I need a certain program or system to do a database?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You can use an xml "database" which is essentially a special text file. But it's probably more work than you're looking for.

A common database is http://www.mysql.com and you can use PHPMyAdmin to administer it (using http://www.php.net as the language) but it depends on your needs. Personally I find it easier to use a database than a text file, but it's up to you.

They have: 20 posts

Joined: Sep 2003

yes, yes... I too prefer MySQL far more than flat text files. but we have to work with what we have available, eh?

as for doing this with JavaScript....what I would do is create an array for addresses. Enter each address as a separate element, then you can search amongst the contents of the elements using some functions that JavaScript has built-in. I'll have to do more research to get specifics to ya (it's been a long while since I did this sort of thing in JS), unless you don't mind doing some light research yourself?

The problem with this approach (minus PHP) is that each address would be hard-coded into the page. It's not all that bad, but it's just..not my cup of tea anymore Wink. It does make things expandable, tho.

You could also make an array for each part of the address to make things a little more interesting. It's not really practical for this application, but it is possible. This sort of approach could be used to ... say, tell how many addresses there are with a certain zip code or a certain street or a certain city... blabla. just a thought.

what say you?

Cold.....so..cold!!!

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

You don't have to hardcode it into the page. Stick the array in a .js file and call it using <script src="">. Smiling

Or you could indeed use an xml file and write a parser in JS (I don't know of any existing scripts, but it's likely there are).

I made a JS search once, and it was, well, limited. Imo, expanding JS search functionality is wasted effort. Use it for procuring PHP or similar alternatives. Smiling

They have: 20 posts

Joined: Sep 2003

well, all of the info is still hardcoded *somewhere*, whether it be the actual HTML file or an external .js. The external .js would actually be a better idea if you plan on adding addresses at all... That way you don't have to fool around with the HTML file at all.. just addresses.

Cold.....so..cold!!!

druagord's picture

He has: 335 posts

Joined: May 2003

One thing you have to be careful with that kind of application is the growth of the list. probably for now the customer just a few adress to search from. but when he is going to see the result is going to get all exited and he will insert a few thousand adress then he will come back to you and say that everything is slow

IF , ELSE , WHILE isn't that what life is all about

They have: 25 posts

Joined: Nov 2002

Is mysql a program or a scripting language?

druagord's picture

He has: 335 posts

Joined: May 2003

mysql is a database server the easiest way to access it is to use php wich is a server side scripting language. With that kind of system you can thousands of adress and the search will still be fast

IF , ELSE , WHILE isn't that what life is all about

They have: 25 posts

Joined: Nov 2002

does it cost to use mysql?

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

http://www.mysql.com
http://www.php.net
http://www.phpmyadmin.net/
http://www.perl.com

All are open-source languages/applications and are free to use. You must, however, do all support and installation yourself. Happily, there is a large community to help you through the process.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.