|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
Query Form
What I'm trying to do is query a database (MySQL) for zip code matches. I can build a page that lists them as soon as I go to the page, and allows me to edit them and update them, which is great, but I have had no luck building a form where someone could enter in any given zip code and find info about it (i.e. what state and/or city its in). I have been poking around for even a tutorial but had no luck. Anyone by chance know of a good tutorial on this subject or some example code I could learn from? Thanks in advance for any help you might have to offer.
|
|
#2
|
|||
|
|||
|
RE: Query Form
SELECT * FROM table WHERE zip_code = '{$_POST['zip']}'
that will find zip codes that match it exactly... |
|
#3
|
|||
|
|||
|
RE: Query Form
Excellent, thanks for that D1NGO =)
|
|
#4
|
|||
|
|||
|
Digging a little deeper...
That code you gave me worked perfectly, thanks again for that. Another question though if you or anyone else has the time...
Could you also with php find near matches? I can't even begin to think how I'd go about that. For example, would you tell it to look for something like 9810* or even 981** or 98***? Now that would be pretty sweet. Anyone have any ideas/know how on that? All help graciously excepted as always =) |
|
#5
|
|||
|
|||
|
RE: Query Form
Code:
SELECT * FROM table WHERE zip_code LIKE '{$_POST['zip']}'
and just enter starting digits, ie "98" |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > Query Form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|