Ignore:
Timestamp:
Feb 11, 2014, 10:47:44 PM (10 years ago)
Author:
rvelices
Message:

arrayfromquery optimizations: move double if from inside loop to outside + use directly mysqli calls to avoid function call overhead for every row retrieved from db

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/category_cats.inc.php

    r26461 r27336  
    134134if ($conf['display_fromto'])
    135135{
    136   $dates_of_category = array();
    137136  if (count($category_ids) > 0)
    138137  {
     
    140139SELECT
    141140    category_id,
    142     MIN(date_creation) AS date_creation_min,
    143     MAX(date_creation) AS date_creation_max
     141    MIN(date_creation) AS `from`,
     142    MAX(date_creation) AS `to`
    144143  FROM '.IMAGE_CATEGORY_TABLE.'
    145144    INNER JOIN '.IMAGES_TABLE.' ON image_id = id
     
    156155  GROUP BY category_id
    157156;';
    158     $result = pwg_query($query);
    159     while ($row = pwg_db_fetch_assoc($result))
    160     {
    161       $dates_of_category[ $row['category_id'] ] = array(
    162         'from' => $row['date_creation_min'],
    163         'to'   => $row['date_creation_max'],
    164         );
    165     }
     157    $dates_of_category = query2array($query, 'category_id');
    166158  }
    167159}
Note: See TracChangeset for help on using the changeset viewer.