limit next / prev to 1 row

git-svn-id: file:///home/shish/svn/shimmie2/trunk@221 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-07-05 18:05:54 +00:00
parent 431b6a653e
commit 1ecb6b688c

View file

@ -252,13 +252,13 @@ class Database {
}
if(count($tags) == 0) {
$row = $this->db->GetRow("{$this->get_images} WHERE id $gtlt ? ORDER BY id $dir", array((int)$id));
$row = $this->db->GetRow("{$this->get_images} WHERE id $gtlt ? ORDER BY id $dir LIMIT 1", array((int)$id));
}
else {
$tags[] = ($next ? "id<$id" : "id>$id");
$dir = ($next ? "DESC" : "ASC");
$querylet = $this->build_search_querylet($tags);
$querylet->append_sql("ORDER BY id $dir");
$querylet->append_sql("ORDER BY id $dir LIMIT 1");
$row = $this->db->GetRow($querylet->sql, $querylet->variables);
}