For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > January 2005 > GROUP BY? Urgent help needed with selection list









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author GROUP BY? Urgent help needed with selection list
Chris Payne

2005-01-23, 3:56 am

Hi there everyone,



I’m using the following code to populate cities from a huge database:



<select name="fm_city[]" id="fm_city[]" multiple>

<option value=0>Show All</option>

<?

$sqla = "SELECT DISTINCT(Area) FROM MLS_Listings ORDER BY Area";



$sql_resulta = mysql_query($sqla,$connection)

or die("Couldn't execute query.");

while ($row = mysql_fetch_array($sql_resulta)) {

$Area = $row["Area"];



?>

<option value="<?=$Area?>">

<?=$Area?>

</option>

<? }; ?>

</select>



This works great, no problems BUT the client now needs is so the cities are
grouped, but it’s not so simple. For example, say you have Akron, Akron
Central etc …. They need them so that ALL Akrons appear together, the
problem is, that also includes some which are SE Akron etc …. So, of course
that appears further down the list under S. How can I group this way? I am
pretty lost on this.



Any help would REALLY be appreciated.



Chris


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.7.2 - Release Date: 1/21/2005


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com