Changeset 29430 for trunk/search.php
- Timestamp:
- Sep 8, 2014, 11:46:50 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/search.php
r28744 r29430 215 215 SELECT 216 216 author, 217 COUNT(*) AS counter217 id 218 218 FROM '.IMAGES_TABLE.' AS i 219 219 JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.image_id = i.id … … 227 227 ).' 228 228 AND author IS NOT NULL 229 GROUP BY author 229 GROUP BY author, id 230 230 ORDER BY author 231 231 ;'; 232 $authors = query2array($query); 232 $author_counts = array(); 233 $result = pwg_query($query); 234 while ($row = pwg_db_fetch_assoc($result)) 235 { 236 if (!isset($author_counts[ $row['author'] ])) 237 { 238 $author_counts[ $row['author'] ] = 0; 239 } 240 241 $author_counts[ $row['author'] ]++; 242 } 243 244 foreach ($author_counts as $author => $counter) 245 { 246 $authors[] = array( 247 'author' => $author, 248 'counter' => $counter, 249 ); 250 } 233 251 234 252 $template->assign('AUTHORS', $authors);
Note: See TracChangeset
for help on using the changeset viewer.