implemented order by on filter by tag.

This commit is contained in:
2025-03-30 21:08:05 -06:00
parent 5a5471da5d
commit 5125612c05
+2 -2
View File
@@ -16,7 +16,7 @@ function article_ids_by_recency()
function articles_ids_by_author($author_id) function articles_ids_by_author($author_id)
{ {
$query = 'SELECT article_id FROM article ORDER BY published_at DESC WHERE author_id = ' . $author_id . ';'; $query = 'SELECT article_id FROM article WHERE author_id = ' . $author_id . ' ORDER BY published_at DESC;';
$results = query_one_or_more_results($query); $results = query_one_or_more_results($query);
$ids = []; $ids = [];
@@ -41,7 +41,7 @@ function article_tags()
function article_ids_by_tag($tag_id) function article_ids_by_tag($tag_id)
{ {
$query = 'SELECT article_id FROM article_tags INNER JOIN tags ON article_tags.tag_id = tags.tag_id WHERE tag = "' . $tag_id . '";'; $query = 'SELECT article_id FROM article WHERE article.article_id IN ( SELECT article_tags.article_id FROM article_tags INNER JOIN tags ON article_tags.tag_id = tags.tag_id WHERE tag = "' . $tag_id . '") ORDER BY published_at DESC;';
$results = query_one_or_more_results($query); $results = query_one_or_more_results($query);
$ids = []; $ids = [];