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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:44:00+00:00 2026-06-11T02:44:00+00:00

So i have 3 tables, 2 with data and 1 to connect the other

  • 0

So i have 3 tables, 2 with data and 1 to connect the other 2 through foreign keys.
It’s something like this:

student(ID_stud, etc)
specialization(ID_spec,spec_name)
study(ID_stud,ID_spec, etc)

Now i’m working at an Edit.php menu(i did the add menu with the list) and i need specializations in a drop-down-menu with the value from the mysql already selected

Here is what i did so far but i only get the correct value selected repeating itself n times

<select name="specialization" type="text">
        <?php
        $specialization=$_POST['specialization'];
        $list_spec=mysql_query("SELECT * FROM specialization, study, student WHERE $ID_stud=study.ID_stud and specialization.ID_spec=study.ID_spec ");
        $array_spec=mysql_fetch_array($list_spec);
        while ($array_spec = mysql_fetch_array($list_spec)){?>
        <option selected="<? echo $array_spec['ID_spec'] ?>"><?php echo $array_spec['spec_name'];?></option>
        <?php }?>
        </select>
  • 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-11T02:44:01+00:00Added an answer on June 11, 2026 at 2:44 am

    You just need to set the selected attribute on the item that is selected. All the others will not have a selected attribute. The value of this attribute does not matter.

    Something like this:

    <option <? if(isSelected) echo 'selected' ?>><?php echo $array_spec['spec_name'];?></option>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three tables of data: table: cars [10,000 rows] table: planes [2,000 rows]
I have some tables with data: Category CategoryID CategoryName 1 Home 2 Contact 3
Here's the scenario: I have 2 tables with data, one is the 2009 version
i have two data tables with the same structure the first one has one
I have a database with two tables: data and file . file_id is a
In my data model I have a fairly common division between my objects/tables/data: Transactional
I have several tables 1 contacts and multiple data. Contacts has an ID field
I have several tables that I am selecting data from. I am trying to
Excel (2010) has functionality to create pivot tables from an external data source like
I have gone similar threads like Django persistent database connection and other stuff on

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.