issue90, display also photos which are not tagged
[phpfspot.git] / phpfspot.class.php
index 99f5a173f97601e899b4ae593dcfb00aa0f32ef1..05532044dbfa2015d63bdc8f6082c712238312e7 100644 (file)
@@ -866,13 +866,14 @@ class PHPFSPOT {
 
       /* return all available photos */
       $query_str = "
 
       /* return all available photos */
       $query_str = "
-         SELECT DISTINCT photo_id
-            FROM photo_tags pt
-         INNER JOIN photos p
+         SELECT p.id
+         FROM photos p
+         LEFT JOIN photo_tags pt
             ON p.id=pt.photo_id
             ON p.id=pt.photo_id
-         INNER JOIN tags t
+         LEFT JOIN tags t
             ON pt.tag_id=t.id
       ";
             ON pt.tag_id=t.id
       ";
+
       if(isset($additional_where_cond)) 
          $query_str.= "WHERE ". $additional_where_cond ." ";
 
       if(isset($additional_where_cond)) 
          $query_str.= "WHERE ". $additional_where_cond ." ";
 
@@ -885,7 +886,7 @@ class PHPFSPOT {
 
       $result = $this->db->db_query($query_str);
       while($row = $this->db->db_fetch_object($result)) {
 
       $result = $this->db->db_query($query_str);
       while($row = $this->db->db_fetch_object($result)) {
-         array_push($matched_photos, $row['photo_id']);
+         array_push($matched_photos, $row['id']);
       }
       return $matched_photos;
 
       }
       return $matched_photos;