issue97, add missing DISTINCT keyword to SQL query
authorAndreas Unterkircher <unki@netshadow.at>
Sat, 12 Jan 2008 11:00:30 +0000 (12:00 +0100)
committerAndreas Unterkircher <unki@netshadow.at>
Sat, 12 Jan 2008 11:00:30 +0000 (12:00 +0100)
Signed-off-by: Andreas Unterkircher <unki@netshadow.at>
phpfspot.class.php

index 9cffc58461d73c09d214e29eb7a1ccaa7e24ce6b..c2ec3ac78e381c738b68a169cef3657463bf7f33 100644 (file)
@@ -874,7 +874,7 @@ class PHPFSPOT {
 
       /* return all available photos */
       $query_str = "
 
       /* return all available photos */
       $query_str = "
-         SELECT p.id
+         SELECT DISTINCT p.id
          FROM photos p
          LEFT JOIN photo_tags pt
             ON p.id=pt.photo_id
          FROM photos p
          LEFT JOIN photo_tags pt
             ON p.id=pt.photo_id
@@ -886,10 +886,10 @@ class PHPFSPOT {
          $query_str.= "WHERE ". $additional_where_cond ." ";
 
       if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) {
          $query_str.= "WHERE ". $additional_where_cond ." ";
 
       if(isset($this->cfg->show_tags) && !empty($this->cfg->show_tags)) {
-        if(isset($additional_where_cond))
-           $query_str.= "AND t.name IN ('".implode("','",$this->cfg->show_tags). "')";
-        else
-           $query_str.= "WHERE t.name IN ('".implode("','",$this->cfg->show_tags). "')";
+         if(isset($additional_where_cond))
+            $query_str.= "AND t.name IN ('".implode("','",$this->cfg->show_tags). "')";
+         else
+            $query_str.= "WHERE t.name IN ('".implode("','",$this->cfg->show_tags). "')";
       }
  
       if(isset($order_str))
       }
  
       if(isset($order_str))