Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6151929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:50:29+00:00 2026-05-23T19:50:29+00:00

I have a Yii dropdown which loads a table of cities, states, zipcodes, lat

  • 0

I have a Yii dropdown which loads a table of cities, states, zipcodes, lat and lon. When loading the state dropdown, it takes forever. Is there a way to speed up the query to cut down on pageload time? I’ve included my view:

echo $form->dropDownList($model,'State', CHtml::listData(Zipcodes::model()->findAll(),
'State', 'State', 'State'), array('empty'=>'-- Choose State --'));

The table is 41,000 entries. Setting the $groupField in listData() didn’t seem to give any noticeable improvements.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:50:29+00:00Added an answer on May 23, 2026 at 7:50 pm

    Using CDbCriteria, I set the “GROUP BY” for the query:

    $stateGroupBy = new CDbCriteria; // i got that bitch criteria. bitches love criteria!
    $stateGroupBy->group = 'State'; // group by state
    echo $form->dropDownList($model, 'State', CHtml::listData(Zipcodes::model()->findAll($stateGroupBy), 'State', 'State'), 
            array('ajax' => 
                array(
                      'type'=>'POST', //request type
                      'url'=>CController::createUrl('search/dynamiccities'), #we don't have to use search/, we could just say dynamiccities
                      'update'=>'#Zipcodes_City',
                      /*'data'=>'js:jQuery(this).serialize()'*/
                      ),
                'empty'=>'-- Choose State --')
            );
    

    I flaked out in getting back to this, but this cut down on the load significantly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in my YII form i have a dropdown depending on a table to another
i have a countries, states, cities tables , and I need 3 dropdown menus
In my Yii application, I have a model that represents siteconfig table and have
I have a model Animal in Yii which has two relations, mainRace and secondaryRace
Yii CMS I have a unique composite key in the table 'category', website_id +
I'm writing an extension for the Yii framework which I have asked on here
I'm using yii active records for mysql , and i have a table where
I am using PHP Yii Framework with MongoDB(yiimongodbsuite). I have created a Model which
We have an Yii-based PHP application which does some generic actions (like Share with
I have the following table structure. tb_posts has the field author_id which relates to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.