From a33a3d2afb6a861e194599973e31e5e448617296 Mon Sep 17 00:00:00 2001 From: tcit Date: Sat, 22 Mar 2014 11:09:18 +0100 Subject: Implemented rudimental search engine --- inc/poche/Database.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'inc/poche/Database.class.php') 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 { public function getLastId($column = '') { return $this->getHandle()->lastInsertId($column); } + + public function search($term){ + $search = '%'.$term.'%'; + $query = $this->getHandle()->prepare("SELECT * FROM entries WHERE content LIKE ?"); + $query->execute(array($search)); + $entries = $query->fetchAll(); + return $entries; + } public function retrieveAllTags($user_id, $term = null) { $sql = "SELECT DISTINCT tags.*, count(entries.id) AS entriescount FROM tags -- cgit v1.2.3