Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

State and abbreviations How I did it.. 8 years 8 months ago #11499

  • neyworg
  • neyworg's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 40
  • Thank you received: 9
So I was frustrated at having the venues with full state names and than a search for NE not only got me Nebraska also got me New York, New Jersey and others..

So what I did was I changed all my states to Full state names..

I added a field called abbrev and then set it to the abbreviation matching the state

Than in my model for view type I replaced case 5 in the search filter switch..
if (strlen($search) != 2 ){
	$where[] = ' LOWER(l.state) LIKE \'%'.$search.'%\' ';}else{$where[] = ' LOWER(l.abbrev) LIKE \'%'.$search.'%\' ';}

So now if a person searches for the 2 character they will search the abbrev field not the state.

Is this proper coding NO, but it solves a problem I have had.
JEM 2.0.1 - J3.3.3 PHP 5.4.4 NGINX!! | www.usyw.org
The following user(s) said Thank You: ernst67

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.391 seconds

Donate

If you find JEM useful and if you use it on your site, please consider a donation to the project.

Private Messages

You are not logged in.

Follow us......