aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Database.class.php
diff options
context:
space:
mode:
authortcit <tcit@tcit.fr>2014-03-22 11:09:18 +0100
committertcit <tcit@tcit.fr>2014-03-22 11:09:18 +0100
commita33a3d2afb6a861e194599973e31e5e448617296 (patch)
treea8c846472db8fabe7cadbaad0f87bb420ce228ae /inc/poche/Database.class.php
parent028e34b6c40c3571d35c49d5a27b7eac19ceb4ef (diff)
downloadwallabag-a33a3d2afb6a861e194599973e31e5e448617296.tar.gz
wallabag-a33a3d2afb6a861e194599973e31e5e448617296.tar.zst
wallabag-a33a3d2afb6a861e194599973e31e5e448617296.zip
Implemented rudimental search engine
Diffstat (limited to 'inc/poche/Database.class.php')
-rwxr-xr-xinc/poche/Database.class.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php
index 5b51b507..6aad16c1 100755
--- a/inc/poche/Database.class.php
+++ b/inc/poche/Database.class.php
@@ -388,6 +388,14 @@ class Database {
388 public function getLastId($column = '') { 388 public function getLastId($column = '') {
389 return $this->getHandle()->lastInsertId($column); 389 return $this->getHandle()->lastInsertId($column);
390 } 390 }
391
392 public function search($term){
393 $search = '%'.$term.'%';
394 $query = $this->getHandle()->prepare("SELECT * FROM entries WHERE content LIKE ?");
395 $query->execute(array($search));
396 $entries = $query->fetchAll();
397 return $entries;
398 }
391 399
392 public function retrieveAllTags($user_id, $term = null) { 400 public function retrieveAllTags($user_id, $term = null) {
393 $sql = "SELECT DISTINCT tags.*, count(entries.id) AS entriescount FROM tags 401 $sql = "SELECT DISTINCT tags.*, count(entries.id) AS entriescount FROM tags