Jump to content

how to 'orden' dropdown menu alphabetically


stockychaser

Recommended Posts

I want the result of the code below, so that the dropdown menu is alphabetically ordened..

 

 

							<label>
							<select name="StuffCategory" id="StuffCategory" class="validate[required]" style="width: 350px;">
								<option value="">Select Stuff Category...</option>

								<?php while($obj_queryStuffCategory = mysql_fetch_object($result_queryStuffCategory)) { ?>
									<option value="<?php echo $obj_queryStuffCategory->StuffCatID;?>"
									<?php if($obj_queryStuffCategory->StuffCatID == $dataAd[stuffCategory]) { echo 'selected="selected"'; } ?> >
									<?php echo $obj_queryStuffCategory->StuffCategory;?></option>
								<?php } ?>

							</select>
						</label>

Link to comment
Share on other sites

The following is the syntax prototype for a SELECT query. The required position of the ORDER BY term is in red -

 

SELECT

    [ALL | DISTINCT | DISTINCTROW ]

      [HIGH_PRIORITY]

      [sTRAIGHT_JOIN]

      [sql_SMALL_RESULT] [sql_BIG_RESULT] [sql_BUFFER_RESULT]

      [sql_CACHE | SQL_NO_CACHE] [sql_CALC_FOUND_ROWS]

    select_expr [, select_expr ...]

    [FROM table_references

    [WHERE where_condition]

    [GROUP BY {col_name | expr | position}

      [ASC | DESC], ... [WITH ROLLUP]]

    [HAVING where_condition]

    [ORDER BY {col_name | expr | position}

      [ASC | DESC], ...]

    [LIMIT {[offset,] row_count | row_count OFFSET offset}]

    [PROCEDURE procedure_name(argument_list)]

    [iNTO OUTFILE 'file_name'

        [CHARACTER SET charset_name]

        export_options

      | INTO DUMPFILE 'file_name'

      | INTO var_name [, var_name]]

    [FOR UPDATE | LOCK IN SHARE MODE]]

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.