]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - inc/poche/Database.class.php
much better fix for #1082
[github/wallabag/wallabag.git] / inc / poche / Database.class.php
index a987b7cc7be88e8551574357cc3ef998e94b818b..65675afe1a53b6c4ed9510f9850197b99cbfa27a 100755 (executable)
@@ -411,6 +411,16 @@ class Database {
 
         return $count;
     }
+    public function getRandomId($user_id) {
+        $random = (STORAGE == 'mysql') ? 'RAND()' : 'RANDOM()';
+        $sql = "SELECT id FROM entries WHERE user_id=? ORDER BY ". $random . " LIMIT 1";
+        $params = array($user_id);
+        $query = $this->executeQuery($sql, $params);
+        $id = $query->fetchAll();
+
+        return $id;
+    }
+
 
     public function updateContent($id, $content, $user_id)
     {