Changeset 610 for trunk/admin
- Timestamp:
- Nov 20, 2004, 6:23:42 PM (20 years ago)
- Location:
- trunk/admin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r606 r610 487 487 AND id IN ('.implode(',', $cat_ids).') 488 488 ;'; 489 $result = pwg_query( $query);490 while ( $row = mysql_fetch_array( $result ))489 $result = pwg_query($query); 490 while ($row = mysql_fetch_array($result)) 491 491 { 492 492 $query = ' … … 496 496 AND image_id = '.$row['representative_picture_id'].' 497 497 ;'; 498 $result = pwg_query( $query ); 499 if (mysql_num_rows($result) == 0) 500 { 498 $sub_result = pwg_query($query); 499 if (mysql_num_rows($sub_result) == 0) 500 { 501 // set a new representative element for this category 501 502 $query = ' 503 SELECT image_id 504 FROM '.IMAGE_CATEGORY_TABLE.' 505 WHERE category_id = '.$row['id'].' 506 ORDER BY RAND() 507 LIMIT 0,1 508 ;'; 509 $sub_sub_result = pwg_query($query); 510 if (mysql_num_rows($sub_sub_result) > 0) 511 { 512 list($representative) = mysql_fetch_array(pwg_query($query)); 513 $query = ' 514 UPDATE '.CATEGORIES_TABLE.' 515 SET representative_picture_id = '.$representative.' 516 WHERE id = '.$row['id'].' 517 ;'; 518 pwg_query($query); 519 } 520 else 521 { 522 $query = ' 502 523 UPDATE '.CATEGORIES_TABLE.' 503 524 SET representative_picture_id = NULL 504 525 WHERE id = '.$row['id'].' 505 526 ;'; 506 pwg_query( $query ); 527 pwg_query($query); 528 } 507 529 } 508 530 } -
trunk/admin/remote_site.php
r606 r610 431 431 } 432 432 $query.= ' 433 ;'; 434 pwg_query($query); 435 // set a new representative element for this category 436 $query = ' 437 SELECT image_id 438 FROM '.IMAGE_CATEGORY_TABLE.' 439 WHERE category_id = '.$category_id.' 440 ORDER BY RAND() 441 LIMIT 0,1 442 ;'; 443 list($representative) = mysql_fetch_array(pwg_query($query)); 444 $query = ' 445 UPDATE '.CATEGORIES_TABLE.' 446 SET representative_picture_id = '.$representative.' 447 WHERE id = '.$category_id.' 433 448 ;'; 434 449 pwg_query($query); -
trunk/admin/update.php
r606 r610 513 513 (category_id,image_id) VALUES 514 514 '.implode(',', $ids).' 515 ;'; 516 pwg_query($query); 517 518 // set a new representative element for this category 519 $query = ' 520 SELECT image_id 521 FROM '.IMAGE_CATEGORY_TABLE.' 522 WHERE category_id = '.$category_id.' 523 ORDER BY RAND() 524 LIMIT 0,1 525 ;'; 526 list($representative) = mysql_fetch_array(pwg_query($query)); 527 $query = ' 528 UPDATE '.CATEGORIES_TABLE.' 529 SET representative_picture_id = '.$representative.' 530 WHERE id = '.$category_id.' 515 531 ;'; 516 532 pwg_query($query);
Note: See TracChangeset
for help on using the changeset viewer.