Jump to content


Avoiding multiple entries

  • Please log in to reply
1 reply to this topic

#1 lional

  • Members
  • PipPipPip
  • Advanced Member
  • 266 posts

Posted 20 July 2006 - 09:22 AM

I am trying to create a drop-down box where the variables are pulled from a mysql table. The drop-down box is for cities that the client exists. The roblem that I am having is that there may be more than one entry of the same city if more than one client exists in the same city, but I only want one to appear in the drop-down box. How do I use PHP to only show one entry n the drop_down when multiple entries exist.



#2 brown2005

  • Members
  • PipPipPip
  • Advanced Member
  • 943 posts

Posted 20 July 2006 - 09:23 AM

$query=mysql_query("SELECT members_county, COUNT(*) AS no FROM members GROUP BY members_county;");
while($r=mysql_fetch_array($query)) {
echo $r[members_county]." (".$r[no].")<br />";

just substitue ur values

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users