As usual. John knows best. Thanks! Aaron -----Original Message----- From: CPT John W. Holmes [mailto:holmes072000@charter.net] Sent: July 25, 2003 3:05 PM To: Aaron Wolski; php-db@lists.php.net Subject: Re: query and display acting weird... Probably need: ORDER BY t.manufacturer, t.colourID ---John Holmes... ----- Original Message ----- From: "Aaron Wolski" <aaronjw@martekbiz.com> To: <php-db@lists.php.net> Sent: Friday, July 25, 2003 2:58 PM Subject: query and display acting weird... > Hi Guys, > > Code: > > echo "<select name=\"patternThreads[]\" size=\"10\" multiple > style=\"font-family:monospace;\">\n"; > > $query = "select t.manufacturer, t.id, t.colour, t.colourID, t.type, > p.thread_index FROM kcs_threads t LEFT JOIN kcs_patternthreads p ON t.id > = p.thread_index WHERE p.pattern_index = '$id' OR p.pattern_index IS > NULL ORDER BY t.colourID"; > > $thread_manufacturer = ''; > > $result = db_query($query); > while($thread = db_fetch($result)) { > > if($thread_manufacturer != $thread['manufacturer']) { > echo "<option value=\"\" > class=\"adminEditLink\">{$thread['manufacturer']}</option>\n"; > $thread_manufacturer = $thread['manufacturer']; > } > } > > echo "</select>\n"; > > In my select box I am getting results like: > > Canterbury Cross Fabrics > Zweigart > Permin > Zweigart > > I SHOULD be getting: > > Canterbury Cross Fabrics > Zweigart > Permin > > > This was once working.. as it should have but today more data was dumped > into the table which is causing the second Zweigart to be displayed. > > If I group the manufacturer in the query then I only one record > displayed for the corresponding manufacturers. > > Any clue how I can make it so that everything is sorted under grouped > manufacturers but still get ALL the results for the manufacturer at the > same time? > > Have over 4000 records which was causing a LONG loading time in the > browser so John Holmes gave me the above query to replace where I had 3 > queries doing the same thing. > > > ANY thoughts would be greatly welcomed! > > Thanks > > Aaron > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php