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 4603802
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:12:16+00:00 2026-05-22T00:12:16+00:00

To give some context, the following dropdown is within a form that gives the

  • 0

To give some context, the following dropdown is within a form that gives the current profile description of an animal stored in the database: i.e, this pony is yea high, of this gender, owned by somesuch, etc. The purpose of the form is to edit these current values. There are various options that can be overwitten freely, others where I want the choice limited to options from a dropdown menu.

The following is the current code I am using for the Gender field, which – although it does work – cannot be the proper way of doing things. I would be more interested in a method that queried the current state, gave the current state as the default option, stored the current state, queried other available states not equal to the stored current state, then gave the remaining states as options. It is that method that I could best adapt to all the other dropdowns on the form.

There are two tables referenced – the profile tbl and the prm_breedgender tbl. Each gender is given an ID, each profile is then given a corresponding ID to signify their gender (male=1, female=2, etc.). The $profile variable is that which signifies the current profile being looked at.

<label for="profile-gender">Gender / Type:</label>
    <select name="profile-gender">
        <?php
            $genderresult = mysql_query("SELECT prm_breedgender.BreedGender
                            FROM profiles, prm_breedgender
                            WHERE ProfileID = $profile
                            AND prm_breedgender.BreedGenderID = profiles.ProfileGenderID");
            $row = mysql_fetch_array($genderresult);
            echo '<option value="' . $row['BreedGenderID'] . '">' . $row[BreedGender] . '</option>';

            $exgenderresult = mysql_query("SELECT prm_breedgender.BreedGender
                            FROM profiles, prm_breedgender
                            WHERE ProfileID = $profile
                            AND prm_breedgender.BreedGenderID != profiles.ProfileGenderID");
            while ($row = mysql_fetch_array($exgenderresult)) {
            echo '<option value="' . $row['BreedGenderID'] . '">' . $row[BreedGender] . '</option>';
            }
        ?>
    </select>

Any help would be greatly appreciated. I’m not all that experience (obviously!) so accompanying explainations would be fantastic.

  • 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-22T00:12:17+00:00Added an answer on May 22, 2026 at 12:12 am

    You can combine it into a single query, using a computed ‘order by’ value:

    SELECT ...
    FROM ...
    WHERE ...
    ORDER BY (prm_breedgender.BreedGenderID = profiles.ProfileGenderID) DESC
    

    The order by clause will evaluate to either true (you’re on the record that should be first) or false (any other record), which gets cased to a value 1/0 which can be sorted, and by doing it in decreasing order, the true values (1) come out first.

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

Sidebar

Related Questions

Could someone give some info regarding the different character sets within visual studio's project
Can someone give me some example code that creates a surface with a transparent
Could you give some guidance for good resources (books, online tutorials) about embedded assembly
Can someone give some hints of how to delete the last n lines from
Are there any tools to give some sort of histogram of where most of
And if you do, can you give some background information on the implementation and
Give me some of your thoughts on which is a better coding practice/makes more
Can anyone point me to a site, or give me some wisdom on how
When creating a UserControl in WPF, I find it convenient to give it some
I'm looking to learn Windows PowerShell. Can someone give me some really good references

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.