[add] page which lists entries for a tag

This commit is contained in:
Nicolas Lœuillet
2013-12-06 14:22:29 +01:00
parent 74ec445a66
commit 4886ed6d36
6 changed files with 65 additions and 3 deletions

View File

@ -258,6 +258,27 @@ class Database {
return $tags;
}
public function retrieveTag($id) {
$tag = NULL;
$sql = "SELECT * FROM tags WHERE id=?";
$params = array(intval($id));
$query = $this->executeQuery($sql, $params);
$tag = $query->fetchAll();
return isset($tag[0]) ? $tag[0] : null;
}
public function retrieveEntriesByTag($tag_id) {
$sql =
"SELECT * FROM entries
LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id
WHERE tags_entries.tag_id = ?";
$query = $this->executeQuery($sql, array($tag_id));
$entries = $query->fetchAll();
return $entries;
}
public function retrieveTagsByEntry($entry_id) {
$sql =
"SELECT * FROM tags