From c70dc852a19e5725dec9311a2257ded2be1cc061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Helleboid=20-=20chtitux?= Date: Sat, 8 Dec 2018 22:36:03 +0100 Subject: [PATCH] Be explicit when id column is ambiguous --- classes/ccache.php | 2 +- classes/counters.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/classes/ccache.php b/classes/ccache.php index 9c5547e7d..2f19140e0 100644 --- a/classes/ccache.php +++ b/classes/ccache.php @@ -141,7 +141,7 @@ class CCache { $sth = $pdo->prepare("SELECT SUM(value) AS sv FROM ttrss_counters_cache, ttrss_feeds - WHERE id = feed_id AND + WHERE ttrss_feeds.id = feed_id AND (cat_id = :cat OR (:cat = 0 AND cat_id IS NULL)) AND ttrss_counters_cache.owner_uid = :uid AND ttrss_feeds.owner_uid = :uid"); diff --git a/classes/counters.php b/classes/counters.php index 2de7d5a3a..cee901304 100644 --- a/classes/counters.php +++ b/classes/counters.php @@ -24,11 +24,11 @@ class Counters { $pdo = DB::pdo(); - $sth = $pdo->prepare("SELECT id AS cat_id, value AS unread, + $sth = $pdo->prepare("SELECT ttrss_feed_categories.id AS cat_id, value AS unread, (SELECT COUNT(id) FROM ttrss_feed_categories AS c2 WHERE c2.parent_cat = ttrss_feed_categories.id) AS num_children FROM ttrss_feed_categories, ttrss_cat_counters_cache - WHERE ttrss_cat_counters_cache.feed_id = id AND + WHERE ttrss_cat_counters_cache.feed_id = ttrss_feed_categories.id AND ttrss_cat_counters_cache.owner_uid = ttrss_feed_categories.owner_uid AND ttrss_feed_categories.owner_uid = ?"); $sth->execute([$_SESSION['uid']]); @@ -172,7 +172,7 @@ class Counters { FROM ttrss_feeds, ttrss_counters_cache WHERE ttrss_feeds.owner_uid = ? AND ttrss_counters_cache.owner_uid = ttrss_feeds.owner_uid - AND ttrss_counters_cache.feed_id = id"); + AND ttrss_counters_cache.feed_id = ttrss_feeds.id"); $sth->execute([$_SESSION['uid']]); while ($line = $sth->fetch()) {