Changeset 652 for trunk/include/functions_category.inc.php
- Timestamp:
- Dec 20, 2004, 11:25:05 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions_category.inc.php
r647 r652 512 512 { 513 513 // searching all the categories id of sub-categories 514 $search_cat_clauses = array(); 515 foreach ($search['fields']['cat']['words'] as $cat_id) 516 { 517 $local_clause = 'uppercats REGEXP \'(^|,)'.$cat_id.'(,|$)\''; 518 array_push($search_cat_clauses, $local_clause); 519 } 520 array_walk($search_cat_clauses, 521 create_function('&$s', '$s = "(".$s.")";')); 522 523 $query = ' 524 SELECT DISTINCT(id) AS id 525 FROM '.CATEGORIES_TABLE.' 526 WHERE '.implode(' OR ', $search_cat_clauses).' 527 ;'; 528 $result = pwg_query($query); 529 $cat_ids = array(); 530 while ($row = mysql_fetch_array($result)) 531 { 532 array_push($cat_ids, $row['id']); 533 } 534 $local_clause = 'category_id IN ('; 535 $local_clause.= implode(',',$cat_ids); 536 $local_clause.= ')'; 537 array_push($clauses, $local_clause); 514 $cat_ids = get_subcat_ids($search['fields']['cat']['words']); 538 515 } 539 516 else 540 517 { 541 $ local_clause = 'category_id IN (';542 $local_clause.= implode(',',$search['fields']['cat']['words']);543 $local_clause.= ')';544 array_push($clauses, $local_clause);545 }518 $cat_ids = $search['fields']['cat']['words']; 519 } 520 521 $local_clause = 'category_id IN ('.implode(',', $cat_ids).')'; 522 array_push($clauses, $local_clause); 546 523 } 547 524 … … 686 663 SELECT COUNT(1) AS count 687 664 FROM '.IMAGES_TABLE.' 665 INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id = ic.image_id 688 666 '.$page['where'].' 689 667 ;';
Note: See TracChangeset
for help on using the changeset viewer.