
06-05-2012, 04:18 AM
|
|
Centurion
|
|
Join Date: Oct 2005
Location: near Norwich, UK
Posts: 174
|
|
ascending order not ascending!
|
Hi,
I have a page with two dropdown boxes on. Each is populated dynamically from a database. They both work fine in that respect, but one (for some reason) refuses to be strictly alphabetical, choosing to start at F rather than A, though it is sort of alphabetical! Anyway, I have attached a screen capture of the offender, and here is the relevant code -
(this first section is the very first thing in the page)
Code:
<?php
include('connection.inc.php');
$conn = dbconnect('pubquery');
$sql="SELECT distinct region FROM clubs order by region";
$newsql="SELECT distinct styletype FROM styles order by styletype";
$result=mysql_query($sql,$conn);
$newresult=mysql_query($newsql,$conn);
?>
And this is the relevant section of the page:
Code:
<?php
echo "<form action='allsearch.php' method='post'><select name='style'>\n";
while ($row = mysql_fetch_assoc($newresult))
{
extract($row);
echo "<option value='$styletype'>$styletype\n";
}
echo "</select>\n";
echo "<input type='submit' value='search styles' name='submitbutton'></form>\n";
?>
The other select box (partly hidden in the screenshot) works fine alphabetically.
|
|