We help IT Professionals succeed at work.
Get Started

Getting 3 duplicate records in a drop down

breeze351
breeze351 asked
on
37 Views
Last Modified: 2016-04-12
I'm getting 3 records in a drop down even tho there is only one record.

		echo '<select id="company" name = "Broker" width="200" style="width: 200px">';
		$SqlString = "select * from comp order by COMPANY";
		$companies = $conn->query($SqlString);
		while ($row_comp = $companies->fetch_array())
		{
			echo "<option value = \"";
			echo $row_comp['TID'];
			echo "\"";
			if ($row_comp['TID'] == $row_survey_data['TID'])
		 	{
				echo " selected";
			}
			echo ">";						
			echo $row_comp['COMPANY'];
			echo "</option>";
		}
		echo "</select>";
		echo "<br>";

Open in new window


What bothers me is that if it was a loop why only 3 times.  I have the same problem with the "persons" that work for the "company".
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2020
Most Valuable Expert 2018
Commented:
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE