Changeset 166
- Timestamp:
- 12/18/07 20:06:45 (6 years ago)
- File:
-
- 1 edited
-
trunk/service.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/service.php
r164 r166 658 658 $database = Core::getDatabase(); 659 659 660 $database->setQuery("SELECT * FROM #__gallery_albums");660 $database->setQuery("SELECT a.*, COUNT(p.albumid) AS pictures FROM #__gallery_albums AS a LEFT JOIN #__gallery_pictures AS p ON a.id = p.albumid GROUP BY a.id"); 661 661 $albumsResponse = $database->loadAssocList(); 662 662 … … 668 668 669 669 foreach ($albumsResponse as $album) { 670 // Needs optimization671 $database->setQuery("SELECT * FROM #__gallery_pictures WHERE albumid = " . (int) $album["id"]);672 673 670 $albums[] = Array( 674 671 "id" => (int) $album["id"], 675 672 "name" => (string) $album["name"], 676 673 "description" => (string) $album["description"], 677 "pictures" => (int) $ database->getNumRows($database->query())674 "pictures" => (int) $album["pictures"] 678 675 ); 679 676 }
Note: See TracChangeset
for help on using the changeset viewer.