aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Database.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Database.class.php')
-rwxr-xr-xinc/poche/Database.class.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 210ebb74..65675afe 100755
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -411,12 +411,14 @@ class Database {
411 411
412 return $count; 412 return $count;
413 } 413 }
414 public function getRandomId($row, $user_id) { 414 public function getRandomId($user_id) {
415 $sql = "SELECT id FROM entries WHERE user_id=? LIMIT 1 OFFSET ? "; 415 $random = (STORAGE == 'mysql') ? 'RAND()' : 'RANDOM()';
416 $params = array($user_id, $row); 416 $sql = "SELECT id FROM entries WHERE user_id=? ORDER BY ". $random . " LIMIT 1";
417 $query = $this->executeQuery($sql, $params); 417 $params = array($user_id);
418 $query = $this->executeQuery($sql, $params);
419 $id = $query->fetchAll();
418 420
419 return $query->fetchAll(); 421 return $id;
420 } 422 }
421 423
422 424