aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/cat_perm.php2
-rw-r--r--admin/element_set_global.php4
-rw-r--r--admin/element_set_unit.php2
-rw-r--r--admin/include/functions.php2
-rw-r--r--admin/include/functions_history.inc.php2
-rw-r--r--admin/rating.php2
-rw-r--r--comments.php2
-rw-r--r--include/calendar_monthly.class.php2
-rw-r--r--include/category_cats.inc.php4
-rw-r--r--include/functions_notification.inc.php6
-rw-r--r--include/functions_tag.inc.php2
-rw-r--r--include/section_init.inc.php4
-rw-r--r--include/ws_functions.inc.php8
-rw-r--r--random.php2
14 files changed, 21 insertions, 23 deletions
diff --git a/admin/cat_perm.php b/admin/cat_perm.php
index 5ef886e1d..79d329115 100644
--- a/admin/cat_perm.php
+++ b/admin/cat_perm.php
@@ -59,7 +59,7 @@ if (!isset($page['cat']))
SELECT id
FROM '.CATEGORIES_TABLE.'
WHERE status = \'private\'
- LIMIT 0 OFFSET 1
+ LIMIT 1
;';
list($page['cat']) = pwg_db_fetch_row(pwg_query($query));
diff --git a/admin/element_set_global.php b/admin/element_set_global.php
index 79e78e8a2..2b7b728ac 100644
--- a/admin/element_set_global.php
+++ b/admin/element_set_global.php
@@ -474,13 +474,11 @@ SELECT id,path,tn_ext,file,filesize,level
FROM '.IMAGES_TABLE.'
WHERE id IN ('.implode(',', $page['cat_elements_id']).')
'.$conf['order_by'].'
- LIMIT '.$page['start'].' OFFSET '.$page['nb_images'].'
+ LIMIT '.$page['nb_images'].' OFFSET '.$page['start'].'
;';
- //echo '<pre>'.$query.'</pre>';
$result = pwg_query($query);
// template thumbnail initialization
-
while ($row = pwg_db_fetch_assoc($result))
{
$src = get_thumbnail_url($row);
diff --git a/admin/element_set_unit.php b/admin/element_set_unit.php
index cf5409296..9abcb3889 100644
--- a/admin/element_set_unit.php
+++ b/admin/element_set_unit.php
@@ -196,7 +196,7 @@ SELECT id,path,tn_ext,name,date_creation,comment,author,file
FROM '.IMAGES_TABLE.'
WHERE id IN ('.implode(',', $page['cat_elements_id']).')
'.$conf['order_by'].'
- LIMIT '.$page['start'].' OFFSET '.$page['nb_images'].'
+ LIMIT '.$page['nb_images'].' OFFSET '.$page['start'].'
;';
$result = pwg_query($query);
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 16928e9ab..b0d5da945 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -597,7 +597,7 @@ SELECT image_id
FROM '.IMAGE_CATEGORY_TABLE.'
WHERE category_id = '.$category_id.'
ORDER BY '.DB_RANDOM_FUNCTION.'()
- LIMIT 0 OFFSET 1
+ LIMIT 1
;';
list($representative) = pwg_db_fetch_row(pwg_query($query));
diff --git a/admin/include/functions_history.inc.php b/admin/include/functions_history.inc.php
index 38d3950eb..298c6937c 100644
--- a/admin/include/functions_history.inc.php
+++ b/admin/include/functions_history.inc.php
@@ -161,7 +161,7 @@ SELECT
WHERE '.$where_separator.'
;';
- // LIMIT '.$page['start'].' OFFSET '.$conf['nb_logs_page'].'
+ // LIMIT '.$conf['nb_logs_page'].' OFFSET '.$page['start'].'
$result = pwg_query($query);
diff --git a/admin/rating.php b/admin/rating.php
index e5fe48d03..da44b4c1c 100644
--- a/admin/rating.php
+++ b/admin/rating.php
@@ -176,7 +176,7 @@ SELECT i.id,
WHERE 1 = 1 ' . $page['user_filter'] . '
GROUP BY r.element_id
ORDER BY ' . $available_order_by[$order_by_index][1] .'
- LIMIT '.$start.' OFFSET '.$elements_per_page.'
+ LIMIT '.$elements_per_page.' OFFSET '.$start.'
;';
$images = array();
diff --git a/comments.php b/comments.php
index 182f673a0..958ff63f3 100644
--- a/comments.php
+++ b/comments.php
@@ -326,7 +326,7 @@ SELECT com.id AS comment_id
if ('all' != $page['items_number'])
{
$query.= '
- LIMIT '.$start.' OFFSET '.$page['items_number'];
+ LIMIT '.$page['items_number'].' OFFSET '.$start;
}
$query.= '
;';
diff --git a/include/calendar_monthly.class.php b/include/calendar_monthly.class.php
index 1a4e70ce3..0bd68ee1e 100644
--- a/include/calendar_monthly.class.php
+++ b/include/calendar_monthly.class.php
@@ -348,7 +348,7 @@ SELECT id, file,tn_ext,path, width, height, DAYOFWEEK('.$this->date_field.')-1 a
$query.= $this->get_date_where();
$query.= '
ORDER BY RAND()
- LIMIT 0 OFFSET 1';
+ LIMIT 1';
unset ( $page['chronology_date'][CDAY] );
$row = pwg_db_fetch_assoc(pwg_query($query));
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php
index 0d35d4a85..dfd009519 100644
--- a/include/category_cats.inc.php
+++ b/include/category_cats.inc.php
@@ -105,7 +105,7 @@ SELECT image_id
"\n AND"
).'
ORDER BY RAND()
- LIMIT 0,1
+ LIMIT 1
;';
$subresult = pwg_query($query);
if (pwg_db_num_rows($subresult) > 0)
@@ -133,7 +133,7 @@ SELECT image_id
"\n AND"
).'
ORDER BY RAND()
- LIMIT 0,1
+ LIMIT 1
;';
$subresult = pwg_query($query);
if (pwg_db_num_rows($subresult) > 0)
diff --git a/include/functions_notification.inc.php b/include/functions_notification.inc.php
index b48fd35be..58091786a 100644
--- a/include/functions_notification.inc.php
+++ b/include/functions_notification.inc.php
@@ -444,7 +444,7 @@ SELECT date_available,
'.$where_sql.'
GROUP BY date_available
ORDER BY date_available DESC
- LIMIT 0 OFFSET '.$max_dates.'
+ LIMIT '.$max_dates.'
;';
$result = pwg_query($query);
$dates = array();
@@ -464,7 +464,7 @@ SELECT DISTINCT id, path, name, tn_ext, file
AND date_available="'.$dates[$i]['date_available'].'"
AND tn_ext IS NOT NULL
ORDER BY RAND(NOW())
- LIMIT 0 OFFSET '.$max_elements.'
+ LIMIT '.$max_elements.'
;';
$dates[$i]['elements'] = array();
$result = pwg_query($query);
@@ -484,7 +484,7 @@ SELECT DISTINCT c.uppercats, COUNT(DISTINCT i.id) img_count
AND date_available="'.$dates[$i]['date_available'].'"
GROUP BY category_id
ORDER BY img_count DESC
- LIMIT 0 OFFSET '.$max_cats.'
+ LIMIT '.$max_cats.'
;';
$dates[$i]['categories'] = array();
$result = pwg_query($query);
diff --git a/include/functions_tag.inc.php b/include/functions_tag.inc.php
index c3978ad39..a05174159 100644
--- a/include/functions_tag.inc.php
+++ b/include/functions_tag.inc.php
@@ -239,7 +239,7 @@ SELECT t.*, count(*) counter
{
$query .= '
ORDER BY counter DESC
- LIMIT 0,'.$max_tags;
+ LIMIT '.$max_tags;
}
else
{
diff --git a/include/section_init.inc.php b/include/section_init.inc.php
index 59809dad6..ce3e3a553 100644
--- a/include/section_init.inc.php
+++ b/include/section_init.inc.php
@@ -490,7 +490,7 @@ SELECT DISTINCT(id)
WHERE hit > 0
'.$forbidden.'
'.$conf['order_by'].'
- LIMIT 0, '.$conf['top_number'].'
+ LIMIT '.$conf['top_number'].'
;';
$page = array_merge(
@@ -517,7 +517,7 @@ SELECT DISTINCT(id)
WHERE average_rate IS NOT NULL
'.$forbidden.'
'.$conf['order_by'].'
- LIMIT 0, '.$conf['top_number'].'
+ LIMIT '.$conf['top_number'].'
;';
$page = array_merge(
$page,
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index da1d7e06f..9adcaf208 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -292,7 +292,7 @@ SELECT i.*, GROUP_CONCAT(category_id) cat_ids
AND ', $where_clauses).'
GROUP BY i.id
'.$order_by.'
-LIMIT '.(int)($params['per_page']*$params['page']).' OFFSET '.(int)$params['per_page'];
+LIMIT '.(int)$params['per_page'].' OFFSET '.(int)($params['per_page']*$params['page']);
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
@@ -682,8 +682,8 @@ SELECT id, date, author, content
FROM '.COMMENTS_TABLE.'
WHERE '.$where_comments.'
ORDER BY date
- LIMIT '.(int)($params['comments_per_page']*$params['comments_page']).
- ' OFFSET '.(int)$params['comments_per_page'];
+ LIMIT '.(int)$params['comments_per_page'].
+ ' OFFSET '.(int)($params['comments_per_page']*$params['comments_page']);
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
@@ -1398,7 +1398,7 @@ SELECT DISTINCT i.* FROM '.IMAGES_TABLE.' i
WHERE '. implode('
AND ', $where_clauses).'
'.$order_by.'
-LIMIT '.(int)($params['per_page']*$params['page']).' OFFSET '.(int)$params['per_page'];
+LIMIT '.(int)$params['per_page'].' OFFSET '.(int)($params['per_page']*$params['page']);
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result))
diff --git a/random.php b/random.php
index 5e3b660f4..81920aba9 100644
--- a/random.php
+++ b/random.php
@@ -52,7 +52,7 @@ SELECT DISTINCT(id)
'WHERE'
).'
ORDER BY RAND(NOW())
- LIMIT 0, '.min(50, $conf['top_number'],$user['nb_image_page']).'
+ LIMIT '.min(50, $conf['top_number'],$user['nb_image_page']).'
;';
// +-----------------------------------------------------------------------+