Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Search City,State OR Zip Code


I would like to build a search box like the one found here at CitySearch.com .

Depending on what the user entered, the results would be sorted by (1) Zip Code, (2) City, or (3) State. If the user entered a Zip Code, I'd like to have all results be sorted by it since a Zip Code would represent the smallest geographical area. If no zip given sort by City and State. It would be easy enough to accomplish if the fields were seperated into different input fields, but I wanted to replicate the CitySearch box exactly because it doesn't take up much room on the page with only one input field.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Populating City,state,country Drop Down Menu
In the registration form I have city, state, country fields. I was
wondering if there was a database available on the net which has the
list of states in each of the countries. That way when a user selects
a country I could automatically populate the state drop down menu ...

Search By Zipcode And State
I began in MySQL section (with your help I built a database) and now into the PHP stage of my project. Basically client wants a search capability on his site. He makes a product, sells to dealers, dealers sell directly to customers. He wants to be able to search dealer contact info by Zip and by State.

DevShed member Baddy was kind enough to offer the following script geared towards the State search. Following his lead, I developed the Zip portion- this is my first stab at PHP- and I basically mirrored whatever he did for State- I did for Zip! Code:

Warning: SQL Error: [Caché ODBC][State : 08S01][Native Code 461]
I'm trying to connect PHP on Caché Database and I'm having a problem. This is the error:

Warning: SQL error: [Caché ODBC][State : 08S01][Native Code 461] [c:phpphp.exe] UNKNOWN MSG, SQL state 08S01 in SQLConnect in c:program filesapache groupapachehtdocscache_test.php on line 27

PHP knowed the ODBC Driver for InterSystem's Caché, but it stops in this problem. How can I resolve this?

PHP Get City From IP
If I clear understand city can be gathered with geoip, but it costs some money. May be anybody knows decision via exec whois? is it possible what you think?

Search By Zip Code
Does anyone know if there are any modules available that enable searches by
zipcode for proximity? I want the user to enter a zipcode and then I want
to somehow search for all entries in a database that are within, say, 25
miles of that zipcode. This is done in many, many sites on the net and I am
wondering if anyone knows of an add-on package to make it happen. No sense
in re-inventing the wheel.

Replace Space With &nbsp In City Names.
We have a database of city names. For cities of more than one word, we want to keep all words on the same line.

so we would replace the space of Los Angeles --> with should be something like
Los Angeles

Is there a way to do this as we display the page with php?

Display Cities And Count How Many Properties Per City
I have a property website, on it I have a drop down box where all cities are displayed. I want to count how many properties there are for each city and then display the number next to the city, so that users can know how many properties are available for each city.

Here is my code so far, I would appreciate someone to help me here!!
Don't be confused by the code I have tried various ways of making this work.
NOTE: I think it would probably be easier to push the cities in an array, use the unique array function to only display 1 of each city, BUT before this, count the amount of times each city appears. Code:

Problem With Search Code
This has a drop down list of 12 categories on a main page. When the browser selects one category and hits submit, the results page will display all the information about the users who have research in that category. There are two parts. First - the search form (on index.php): PHP Code:

Zip Code Search/redirect Script
I'm fairly new to the php/mysql world. I need some help with my first assignment doing some php scripting and was going to see if there was a resource of scripts for this.

Here's what I need to do: Setup a simple zip code search form that will execute a script. A user enters the zip code and it redirects them to one of four pages which is associated with different zip codes (in the state of Georgia). If they enter a zip code that's not on the list, it would redirect them to a page that says something like "this zip code is not a part of the area....etc.". I know how to set up the form to execute the script, just don't know what the script itself should be. I'm assuming I won't need to use a DB, and that the zips would be in the script itself.

Search Failed Message Code?
I am using a mySql database and have a php page that does a search in that database.
I am trying to create the code that will print a 'Search Failed' message if there is no relevant data in the database after a serach.

if(count($HTTP_GET_VARS)) extract($HTTP_GET_VARS);
if(count($HTTP_POST_VARS)) extract($HTTP_POST_VARS);

$db_name = "cleardb";
$table_name = "chdemo";

$connection = @mysql_connect("localhost", "root") or die ("Could not connect.");

$db = @mysql_select_db($db_name, $connection) or die ("no db connection");

$sql = "select * from $table_name where txpyr_id like '$id%' and txpyr_name like '$carriername%' and txpyr_jur like '$txpyr_jur%' limit 5";

$result = mysql_query($sql,$connection) or die ("damn2");

while ($row = mysql_fetch_array($result)) {

$txpyr_jur = $row['txpyr_jur'];
$txpyr_id = $row['txpyr_id'];
$txpyr_name = $row['txpyr_name'];
$txpyr_status = $row['txpyr_status'];
$status_date = $row['status_date'];

Switch Code For Search Page
I had made a very simple search page about a year ago and now I'm trying to add a couple of things and the first step was to add the ability to search by user. I thought I would use a switch command to select the query and then fill my table based off of the selection. Code:

Want PHP Code To Search All The Pages In A Website
i just want to know some code that would retrieve all the pages fron a given website with... that when i give a wesite to code it fetches all the pages in that and make a list for all with address.

Local Source Code Search Engine?
I'm reviewing a clients application, and one of the things I need to do is verify every table in the databse is actually being used in the application.

I assumed one of my many PHP IDE's would be able to do this, but alas no, I can text search but I have hundreds of tables to verify, the application has over 1000 PHP pages and 350 database tables.

Any ideas? I started to write my own code search engine, thinking I could just dump the tablke names into it but getting the code into MySQL to search from was a lot more difficult then I expected (PHP doesnt like to submit PHP code .. even if you put it in XML).

I Need To Search And Replace Lines Of Html Code
I need to search and replace lines of html code using regular expressions. In the example below, all of the information between "href="/ and LAST_MODIFIED="0"> varies from individual entry to entry and has to be ignored.

Can someone write the general expression I need to use? I've been trying to get it right to no avail.

Search For...

PHP Search Engine Code? (Rather Verbose Php Link) Any Ideas?
I've totally hit a brick wall and I've checked the numerous (some
helpful) tutorials in making a php link search engine friendly but the
following link:

<font face="Tahoma" size="2">
<a
href='ps2reviewsdisplay.php?page=ps2/ps2acecombatsquadronleader&type=htm&title=-
Ace Combat Squadron Leader Review - www.impulsegamer.com Australia'>
<span style="text-decoration: none">Ace Combat: Squadron Leader<br>
</span></a></font>

I just don't know how on earth to make it search engine friendly?

Hide Javascript Code From Browsers And Search Engines
I want to hide the javascript code in a php file because it uses a resource from another website, and if the code is visible, search engines are spidering that php page, and also the scripts in it.

Page State With Php?
I'm trying to create a site that pages through data retrieved from a database.

Let's say there are 12 items, and only 3 at a time can be displayed on a single
web page.

So the user needs to see some king of navigation control (a simple link would
suffice) that tells him there X items ahead and Y items behind. This way he can
page through all 12 items, 3 at a time, moving forward and backward.

Does this require some king of page/session state? How will my code know if
items 1 through 3 or 6 through 9 are currently displayed?

My guess is I'm not the first one who has needed to solve this kind of problem.

Saving Memory State
Is that possible to save memory state to a file? (i.e. the content of every variable)

Carry Logging State Across Pages
After login in on first page , how to carry logging state across pages. So, every login names will be displayed on the every pages. I use oracle as my back-end database.

Mainting State Inside A Function?
I have a question which no doubt will pose you people with nor problem whatsoever to help me with

I have written a function to display coherent error messages throughout my entire site

I pass it 2 vars, which contain only text
one is for the document's title, one for the error message in the body (ofcourse there is formatting etc, but thats all inside the function and CSS)

problem is, when the function gets called, it loses state, ie.: the generated page doesnt start the session properly, even though I do this inside the function

what can I do to prevent this? some elements of the site are only shown when a user is logged in, so the effects are rather dramatic ....

Create State-cty Dropdown Lists
I've gotten everything up and running except for this -- I'd like to
be able to have people have a dropdown list of cities in the US to use
(or wherever) and not have to input them manually into a text field.
When you do then there are issues of misspellings, etc.

Now I have a list of cities from each state that is a sample that
works in an html page. Problem is that it takes up 2 MB! Way too much
to load on a single page and I was wondering how this is accomplished
best -- do people use javascripts that can pull information from
another flat flie? Do people use PHP to connect to a mysql database
that might have a list of these fields and then reloads the page?

I'm really not sure of best options and would be grateful for anyone
to give me pointers or whether there are other examples and even
places to buy these databases (not likely but good to have if I decide
to do so.)

Multi-domain Session State
Does anybody have a solution on how to keep a PHP session alive across multiple domains ? A solution that does not involved writing the session ID in the URL because I can't do that.

SQL Error: , SQL State 00000 In SQLConnect
Client is running PHP 4.0.5. on Win2K Professonal SP2 outfitted with Apache 1.3.2. Trying to connect to an Access 2000 DB using a standard odbc_connect() call. The DB is fine, all looks good, but this error is returned:

Warning: SQL error: , SQL state 00000 in SQLConnect in c:program filesapache groupapachehtdocsstaffindex.php on line 10

Anyone seen this one before?

Setting Radio Button State
I am trying to set the state of a radio button. I do not see what I am
doing wrong. Sorry, I am new at this.. I need another set of eyes to
look at this snip of code. I am trying to set the radio button with this
link of code:

echo 'SCRIPT language=JavaScript
setCheckedValue("'.$_SESSION['abbr_letter'].'");</SCRIPT>' //?

<snip of code>

<?php
session_start();
if(!isset($_SESSION['abbr_letter'])) {
$_SESSION['abbr_letter'] = 'A'
}
require_once 'includes/config.inc.php'
require_once 'includes/header.inc.php'

if (xdebug_is_enabled())
echo "enable";
else
xdebug_enable();

//
// Start a Form
?>
<HTML>
<HEAD>
<link href="quotesCss.css" rel="stylesheet" type="text/css">
<SCRIPT TYPE="text/javascript">
<!--
// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue(newValue) {
var len = document.author_abbrv.abbr_letter.length
for(var i = 0; i < len; i++)
{
document.author_abbrv.abbr_letter[i].checked = false;
if(document.author_abbrv.abbr_letter[i].value ==
newValue.toString())
{
document.author_abbrv.abbr_letter[i].checked = true;
}
}
}
-->

Validating A Country / State Form Input
I'm having trouble validating a state and country input. I didn't write it so I'm confused about why my code isn't working with it. Code:

Swap Image - Over State Not Retained - Because Of $_SERVER['PHP_SELF']
I have created a navigation menu with dreamweaver mx. On roll over the image is swapped and onpress the over-state is retained, so the user knows where he is. When using dummy links, like <a href="#"> it works. But in my case:

Using AJAX, How Can The Page Get State Infomation From Backgroud PHP Script?
I'm not familiar with web programming, but I have a problem here.

I have a page. When a user click one button on it, I will use AJAX to
request a PHP script which will do a bunch of tasks, asynchronously.
These tasks might take long time so I want to keep the user informed
of the progress. The problem is that only the PHP script knows the
progress, how can the web page gets these information from PHP script?

Mysql Select Question, Counting Total Recs For Each State?
I have a bunch of event records for various event dates.

I want to write an select state that shows the following

State Count
AZ 50
AR 2
AK 450
CO 75
CT 92

etc.

sorted by state of course.

Change From Win To Linux Server Caused Error SQL State 01S02
I'm using windows server before and there was no problem with the program. The problem happened when i adopt it into Linux servers. I'm using PHP 4.3.0, Ms-Access Database, and ODBC Driver Here's the error message :

Warning: odbc_exec(): SQL error: [unixODBC][Driver Manager]Option value changed, SQL state 01S02 in SQLExecDirect in /home/php/ranking/index.php on line 422 Code:

Search Script Don't Search Empty Values
I'm trying to make a search script. I don't want the script to search for empty values if you don't write anything in one of the searchfields. Does anyone know how to do this, or where I can find examples of advanced searchscripts? Code:

Search DB Using Multiple Search Criteria On Web Form
I have a mysql database with a table with fields ( surname, company, speciality etc..)
I created a simple form so people can search using criterias ( a search field which query all fields , a drop down with the list of surname, drop down with the list of speciality, drop down with a list of countries ).

My system works perfectly well as long as I use only one criteria, However if I select "Plumber" as the speciality and "Scotland" as country, I will get all the entries for Scotland ( even if the speciality is not "plumber") and I will get all the entries for "Plumber" ( even if the coutry is not "Scotland"). Code:

Highlighting Of A Search Term In Search Results
I am writing this simple MySQL and PHP search and what I want to do is to highlight the search term in the results when they are displayed on the screen.  I am able to get it to work. but the seach term will only be highlighted(Make it Bold) only if it matches exactly to what was typed in the search box. 

Is there a way where the search term doesn't have to exactly match in order for it to be highlighted?  Below is the code where I change the the search term into bold to be displayed on the screen.

<?php
$result_manufact = str_replace($splitstr, "<span style="color: red; font-weight: bold;">$splitstr</span>", $manufact);
?>

Command-line Php Displays Code Instead Of Executing Code
I am using CLI PHP to run a PHP script, c:wampphpphp.exe, but
instead of executing my script, it's actually displaying the raw code
instead.

How can I run my code using CLI PHP? I installed WAMP5 on WinXP.

Old Code Vs New Code - Language Syntax Change?
I've recently begun programming PHP again and have found my old code doesn't work anymore. It's been a few years since my code was written, and simple functions don't seem to be working. I've done a bit of research into the syntax again and found the following;

I used to use a function as such;

if ($REQUEST_METHOD=="POST") {
Now I've seen alot of the syntax is
if ($_SERVER($REQUEST_METHOD=="POST")) {
And referencing variables from the form is as such;
$_POST['variable']

Where previously I could reference them in the simple form; $variable

Has there been a language syntax change that would cause my old code to be obsolete? Is there a configuration line that could be changed to allow this old code to work?

I Want Search Script Which Can Search All Pages Under Given URL
I want search script which can search all pages under given URL...
because i want to search my text in given website (like Google's
Domain search)

Search Multiple Search Engines
Does anyone know how it may be possible to write some code to search multiple search engines?

BB Code - Escape A Bracket In BB Code?
Is there a way to escape a "bracket" in BB code? The beginning of a bbcode
post I made starts with something in brackets [like this]. This causes a
strange thing to happen to the remainder of my post. Removing the brackets
makes my post normal. That shows me that I need to escape the brackets.
However, a simple backslash does not seem to do the trick i.e. this [wont
work]

I am not the administrator of the bb forum, just a poster. So I need to know
what to do on my end (as opposed to an adiministrator's power to
reconfigure, etc.

Translate Perl Code To PHP Code.
Can some one transfer this Perl into PHP? It is from the Spreadsheet-WriteExcel. PHP Code:

Search Results ($num_rows) Does Not Match $search Results (PHP,MySQL)?
For example, when I do a database search for a term I get 2 results but the $num_rows says there are 3 results.

I suspect it's because there are similar keywords within different search fields of the SQL statement. But I am stumped as to how I can change this. Any Suggestions? the code:

Code To Display My Code
I am taking a class in PHP and thought that it would be nice to display
the PHP code that generated my pages when the user clicked a link (or
submit button). I have seen page that will display the underlying HTML
on the page and it would be a nice touch...

Adding Php Code Or To Include A Page With Php Code Into A .tpl Page
how would i do this, i am intergrating a phpbb forum system into my site!

Possible From Search Box
Is it possible from search box; to remove word like and ? or any non-key words. I do not want to build a array of words for them to search. All I am saying is - User try to search for and, I want to kill the word and.

Also when user search Blast you can enter last and if the word Blast is in a sentence it will show in relsults how do you stop this from happening?

Here another subject:
If the user miss-spells a word offer them the correct spelling? or sim word. This sounds pretty advance where can I learn how to do something like this?

Anyone Knows How To Search In XML Just Like SQL?
Iam trying to look for ways how to search inside an XML document
like searching a database that has a select statement in SQL?

Search
I'm having a problem with a php3/mysql results display. The problem seems to lie in the search parameters passed to the script, and the Next/Previous links. The parameters are passed from a dropdown boxed called "prodname". The results display aren't relevant to the queries, and somethings aren't displayed at all (even with the wildcard). I've tried different variations on the $prodname%, but with no improvement. Code:

Particular Search
I have a image-website that displays various photos. each photo's are
labelled with integers. I would like to know if there is a method of
converting the integers into a string and gettin a count of the number
of downloads of a particular image.

For eg:
these are the images dloaded by a single user
IMAGES:- 7001,7025,7841,7459,7584,7741,7415
Assuming that i have assigned each of these variables to a string as
$picname=$7001.
Now i would like to search thru the list of numbers and find out which
photo was downloaded how many times i.e no. of hits of each picture.

I thought of using an case block but then the I had to place a counter
for each picture seperately.
Is there anyother better way of producing the same result?

PHP Search Box...
I want to create a search box for my site in PHP. This will only be
to search my site and not the web.

I have never done anything like this before.
Is it difficult to do this in PHP?

Does anyone know of any tutorials etc.. on this?

Search From A Map
I am trying to locate a plug and play piece of software that will allow me to use a map to tie to a search feature. Where you choose a state from a map and then a county and so on. I have been searching the web for days and cant find anything let alone even know what to call it.

Search Within A Search Within A Search
I'm having some trouble with the search field that i am setting up
using PHP and HTML, I am connecting to a database to return proper
information pertaining to something being searched. I originally set
up a search to work like this :

$SQL = "
select id,
name
from repository
where upper(name) like upper('%$search%')
";
$Result=SubmitQuery($db,$SQL);
while (OCIFetch($Result)) {
$repo_id = OCIResult($Result,"ID");
$name = OCIResult($Result,"NAME");
echo"

and display the results accordingly, This was one teer of the
searching, the database would then search modules and files just as
seen above, but I ran into the problem where the correct values are not
being passed, so it was searching all repositories, then all modules,
then all files.... is it possible to search like this:

Repository #1
---Module #1 in Repo#1
------files in Module #1
---Module #2 in Repo #1
------files in Module #2 Repo #1
etc.



Repository #2
--Module #1 in Repo #2
etc......

is this possible to do a search under a search under a search with SQL
PHP?

Search
I was wondering how to have it so that if someone searches hi any posts with hi will come up? or if some searches hi how are you any posts that have "hi" "how" "are" "you" (without the quotes)comes up?


Copyright © 2005-08 www.BigResource.com, All rights reserved