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

  • SEARCH
  • Home
  • 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 8641739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:36:25+00:00 2026-06-12T11:36:25+00:00

My database table is named ‘status’ and it has a column named ‘order’, which

  • 0

My database table is named ‘status’ and it has a column named ‘order’, which is of type float.

I’m trying to sort the status fields based on order from lowest to greatest and input those fields into a dropdown list.

This is the code I’m using:

echo $form->dropDownListRow($my_model, 'status', CHtml::listData(Status::model()->findAll(array('order'=>"'order' ASC")), 'id', 'name'), array('class'=>'span3','prompt'=>Yii::t('forms', 'Please Select A Status')));

But the list is always ordered by status ID. Do I need to do some type casting? If so, how would I typecast my query so that it orders by ‘order’ ascending?

  • 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-06-12T11:36:27+00:00Added an answer on June 12, 2026 at 11:36 am

    You have specified the order incorrectly:

    array('order'=>"'order' ASC")
    

    There are extra quotes around order (the column name), which means that in effect you are not sorting at all. Remove the quotes to fix the problem, but put backticks in their place because order is a reserved word in MySql:

    array('order'=>"`order` ASC")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A database table named users has a column timemarks . The timemark fields look
I have a database table named 'student' in which there is one column named
In ms-access database i have a table named tableA this table has a column
I want to copy data from one database which has table named domains to
I have a database table named tree1, which has a table names student_details.This table
There're too many databases, how can I query which database has a table named
There is a mysql database named: example which has a table named: products it
I have a database table that contains a column named type. For every row
I have a database table (named Topics) which includes these fields : topicId name
My database table have a Timestamp column named as inTime and i am using

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.