[ic] Strange Sorting Results
Adrian P Wilkinson
junk at puffin.org
Wed Sep 15 11:51:34 EDT 2004
Hi Group,
I (with a little bit of help from some IRC users) wrote a little bit of code
a while ago that compiled a drop-down box of brand names (i.e. Hewlett
Packard, Apple, etc) and allowed the user to click 'Go!' to display all
products by that vendor. Here's the code:
[timed-build period="1 hour" file=timed/list_of_mfr force=1]
<FORM ACTION="[area search]" METHOD="POST">
<INPUT TYPE="hidden" NAME="sf" VALUE="vendor">
<SELECT NAME="se" WIDTH="20">
[query sql="SELECT DISTINCT vendor FROM products ORDER BY vendor"
list=1]
<option value="[sql-param vendor]" selected>[sql-filter
20.][sql-param vendor][/sql-filter]</option>
[/query] <input type=submit value="Go!">
</SELECT>
</FORM>
[/timed-build]
I've now noticed two very strange little problems with this:
1. Despite the menu being built from the data available in the tables, it
won't find certain vendors ("no results") in the list it has populated; an
example of this is "XFX - PINE VGA CARDS" so I suspect that it's the space
or the length of the string or something along those lines.
2. The sorting order is supposed to be by product_group and category, i.e.
Storage / CD-RW Drives
- Product 1
- Product 2
- Product 3
Storage / DVD-ROM Drives
- Product 4
- Product 5
ToSortOut / ToSortOut
- Product 6
- Product 7
However, the results come out as follows (for example):
Storage / CD-RW Drives
- Product 1
- Product 2
Storage / DVD-ROM Drives
- Product 4
Storage / CD-RW Drives
- Product 3
ToSortOut / ToSortOut
- Product 6
Storage / DVD-ROM Drives
- Product 5
ToSortOut / ToSortOut
- Product 7
Is anyone able to offer any pointers as to how to resolve these two annoying
little problems? Thanks in advance for any help offered.
Regrads, Ade.
More information about the interchange-users
mailing list