diff options
Diffstat (limited to 'inc/poche/Database.class.php')
-rw-r--r-- | inc/poche/Database.class.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 8e9ee0b7..a89bce41 100644 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php | |||
@@ -258,6 +258,27 @@ class Database { | |||
258 | return $tags; | 258 | return $tags; |
259 | } | 259 | } |
260 | 260 | ||
261 | public function retrieveTag($id) { | ||
262 | $tag = NULL; | ||
263 | $sql = "SELECT * FROM tags WHERE id=?"; | ||
264 | $params = array(intval($id)); | ||
265 | $query = $this->executeQuery($sql, $params); | ||
266 | $tag = $query->fetchAll(); | ||
267 | |||
268 | return isset($tag[0]) ? $tag[0] : null; | ||
269 | } | ||
270 | |||
271 | public function retrieveEntriesByTag($tag_id) { | ||
272 | $sql = | ||
273 | "SELECT * FROM entries | ||
274 | LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id | ||
275 | WHERE tags_entries.tag_id = ?"; | ||
276 | $query = $this->executeQuery($sql, array($tag_id)); | ||
277 | $entries = $query->fetchAll(); | ||
278 | |||
279 | return $entries; | ||
280 | } | ||
281 | |||
261 | public function retrieveTagsByEntry($entry_id) { | 282 | public function retrieveTagsByEntry($entry_id) { |
262 | $sql = | 283 | $sql = |
263 | "SELECT * FROM tags | 284 | "SELECT * FROM tags |