Changeset 4334 for trunk/include


Ignore:
Timestamp:
Nov 21, 2009, 8:52:50 PM (14 years ago)
Author:
nikrou
Message:

Feature 1255 : limit params in sql queries were in wrong order (LIMIT count OFFSET offset)

Location:
trunk/include
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/calendar_monthly.class.php

    r4331 r4334  
    349349    $query.= '
    350350  ORDER BY RAND()
    351   LIMIT 0 OFFSET 1';
     351  LIMIT 1';
    352352    unset ( $page['chronology_date'][CDAY] );
    353353
  • trunk/include/category_cats.inc.php

    r4325 r4334  
    106106    ).'
    107107  ORDER BY RAND()
    108   LIMIT 0,1
     108  LIMIT 1
    109109;';
    110110      $subresult = pwg_query($query);
     
    134134    ).'
    135135    ORDER BY RAND()
    136     LIMIT 0,1
     136    LIMIT 1
    137137  ;';
    138138      $subresult = pwg_query($query);
  • trunk/include/functions_notification.inc.php

    r4331 r4334  
    445445  GROUP BY date_available
    446446  ORDER BY date_available DESC
    447   LIMIT 0 OFFSET '.$max_dates.'
     447  LIMIT '.$max_dates.'
    448448;';
    449449  $result = pwg_query($query);
     
    465465    AND tn_ext IS NOT NULL
    466466  ORDER BY RAND(NOW())
    467   LIMIT 0 OFFSET '.$max_elements.'
     467  LIMIT '.$max_elements.'
    468468;';
    469469      $dates[$i]['elements'] = array();
     
    485485  GROUP BY category_id
    486486  ORDER BY img_count DESC
    487   LIMIT 0 OFFSET '.$max_cats.'
     487  LIMIT '.$max_cats.'
    488488;';
    489489      $dates[$i]['categories'] = array();
  • trunk/include/functions_tag.inc.php

    r4325 r4334  
    240240    $query .= '
    241241  ORDER BY counter DESC
    242   LIMIT 0,'.$max_tags;
     242  LIMIT '.$max_tags;
    243243  }
    244244  else
  • trunk/include/section_init.inc.php

    r3282 r4334  
    491491    '.$forbidden.'
    492492    '.$conf['order_by'].'
    493   LIMIT 0, '.$conf['top_number'].'
     493  LIMIT '.$conf['top_number'].'
    494494;';
    495495
     
    518518    '.$forbidden.'
    519519    '.$conf['order_by'].'
    520   LIMIT 0, '.$conf['top_number'].'
     520  LIMIT '.$conf['top_number'].'
    521521;';
    522522    $page = array_merge(
  • trunk/include/ws_functions.inc.php

    r4331 r4334  
    293293GROUP BY i.id
    294294'.$order_by.'
    295 LIMIT '.(int)($params['per_page']*$params['page']).' OFFSET '.(int)$params['per_page'];
     295LIMIT '.(int)$params['per_page'].' OFFSET '.(int)($params['per_page']*$params['page']);
    296296
    297297    $result = pwg_query($query);
     
    683683  WHERE '.$where_comments.'
    684684  ORDER BY date
    685   LIMIT '.(int)($params['comments_per_page']*$params['comments_page']).
    686     ' OFFSET '.(int)$params['comments_per_page'];
     685  LIMIT '.(int)$params['comments_per_page'].
     686    ' OFFSET '.(int)($params['comments_per_page']*$params['comments_page']);
    687687
    688688    $result = pwg_query($query);
     
    13991399    AND ', $where_clauses).'
    14001400'.$order_by.'
    1401 LIMIT '.(int)($params['per_page']*$params['page']).' OFFSET '.(int)$params['per_page'];
     1401LIMIT '.(int)$params['per_page'].' OFFSET '.(int)($params['per_page']*$params['page']);
    14021402
    14031403    $result = pwg_query($query);
Note: See TracChangeset for help on using the changeset viewer.