query and display acting weird...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux