RE: [PHP-DB] GROUP BY? Urgent help needed with selection list
| From: | Bastien Koert | Date: | Sun, 23 Jan 2005 18:31:33 +0000 |
| Subject: | RE: [PHP-DB] GROUP BY? Urgent help needed with selection list | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-38288@lists.php.net to get a copy of this message | ||
if you have kind of geo id number you could use that, failing to have that info, you could re-arrange the data to have Akron - Central, Akron - SE (so that all is in a standard format)
Bastien
From: "Chris Payne" <cjp@planetoxygene.com> To: <php-db@lists.php.net> Subject: [PHP-DB] GROUP BY? Urgent help needed with selection list Date: Sun, 23 Jan 2005 00:46:18 -0500 Hi there everyone, Im 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 its 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