MYSQL search results with choose

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
RhodySav
Forum Newbie
Posts: 3
Joined: Mon Sep 01, 2008 1:30 pm

MYSQL search results with choose

Post by RhodySav »

Hi there everyone else who is working on Labor Day.

I am trying to find ideas about php query code that will return results that can then be select to continue the program.
There must be a term for this but I just don't have enough history with PHP to know what it is called.

I have an address database, the user enters an address for a look up, if they don't enter the exact address they are out of luck. What I want to do is "if fails" then run a LIKE search and return a list of addresses that might match.

I think I have the code to do the secondary search with the Like and % etc. But I'm stumped with how to display the results in a list that the user can click on and then continue with the program using that address.

We've all seen this on mapquest and superpages when the return other possible address that they have found. That's what I need to accomplish, but don't have any idea of what it is called.

Thanks in advance for any suggestions.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: MYSQL search results with choose

Post by califdon »

You probably need to use Ajax for this, since you probably don't want to reload the entire page. Ajax is not another language, it is just using Javascript to send what is called an asynchronous request to the server to run a server script that will return some data, which the Javascript will insert into the proper place on the web page without reloading it. Read: http://w3schools.com/ajax/default.asp
RhodySav
Forum Newbie
Posts: 3
Joined: Mon Sep 01, 2008 1:30 pm

Re: MYSQL search results with choose

Post by RhodySav »

Thanks Jack..

Wife pulled me away from my office to attend a cookout.

I'll check out your suggestion.

Was hoping to stay with php code...

All the best
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: MYSQL search results with choose

Post by califdon »

You will still use PHP code on the server side, but by the time the user sees your page, it's beyond control of the server, so there is no alternative to using Javascript to detect user actions. The Javascript looks a little daunting at first, but that's only because Internet Explorer browser screwed around with the standards, so you have to test what browser is being used so you can use the appropriate terminology. It's basically boilerplate except for the internal function that determines what to do with the data that's returned by your PHP script on the server.
RhodySav
Forum Newbie
Posts: 3
Joined: Mon Sep 01, 2008 1:30 pm

Re: MYSQL search results with choose

Post by RhodySav »

OK, I think I get what you mean. I'll give it a look.
Thanks
Post Reply